Skip to content

Instantly share code, notes, and snippets.

Avatar
sparking joy

Moritz Jacobs moritzjacobs

sparking joy
View GitHub Profile
View scriptlint-fixed2.txt
$ scriptlint --strict --fix
⧙։⧘ [✔️] ✨ All good
// end result:
{
"name": "my-cool-project",
"version": "1.0.0",
"scripts": {
View scriptlint-fixed.txt
⧙։⧘ [warning] Use of unix double ampersand (&&) in script 'test' is not allowed, consider using npm-run-all/run-s (no-unix-double-ampersand)
⧙։⧘ [✔️] Fixed 2 issues!
// results in …
{
"name": "my-cool-project",
"version": "1.0.0",
"scripts": {
"build": "webpack",
View scriptlint-strict.txt
⧙։⧘ [warning] script name "eslint" should start with one of the allowed namespaces (uses-allowed-namespace)
⧙։⧘ [warning] scripts must be in alphabetic order (alphabetic-order)
⧙։⧘ [warning] Use of unix double ampersand (&&) in script 'test' is not allowed, consider using npm-run-all/run-s (no-unix-double-ampersand)
@moritzjacobs
moritzjacobs / package.json
Last active Mar 3, 2020
scriptlint changes: non-strict
View package.json
{
"name": "my-cool-project",
"version": "1.0.0",
"scripts": {
"test": "npm run build && npm run eslint",
"eslint": "eslint src",
"start": "webpack-dev-server",
"dev": "npm run start",
"build": "webpack"
@moritzjacobs
moritzjacobs / scriptlint.txt
Last active Mar 3, 2020
scriptlint-result #1
View scriptlint.txt
⧙։⧘ [warning] must contain a "start" script (mandatory-start)
⧙։⧘ [warning] must contain a "dev" script (mandatory-dev)
⧙։⧘ [warning] `test` script can't be the default script (no-default-test)
@moritzjacobs
moritzjacobs / package.json
Created Mar 2, 2020
package.json before scriptlint
View package.json
{
"name": "my-cool-project",
"version": "1.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"eslint": "eslint src",
"start-dev": "webpack-dev-server",
"build": "webpack"
},
View sortClothingSizes.js
/**
* JS utility function to sort an array of clothing sizes (["M", "S", "XL", "XXS"])
* by size and not alphabetically.
*
* Usage:
```
clothingSizesSort(["S", "M", "XL"]) // should === ["XXS", "S", "M", "XL")
```
@moritzjacobs
moritzjacobs / class.easy-admin-table.php
Created Jul 3, 2018
helper class for easier table creation in wordpress admin views
View class.easy-admin-table.php
<?php
/**
* Simplified usage of tables in wordpress plugin admin views.
*
* @package EasyAdminTable
* @author Moritz Jacobs <mail@moritzjacobs.de>
* @license GPL-2.0+
* @link http://moritzjacobs.de
*/
View jquery.select-toggler.js
($ => {
/**
* jQuery.selectToggler
*
* replaces a <select><option>… structure with a simple toggle structure
*
* $("select.foobar").selectToggler(function(el){
* el.addClass("foobar-toggler");
* el.find("> *").addClass("foobar-toggles");
* })