Skip to content

Commit

Permalink
fix: run prettier and hopefully release to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzjacobs committed Sep 10, 2020
1 parent 8f3aa72 commit 1820e06
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -23,7 +23,7 @@
"build:scripts": "tsc -p tsconfig.build.json",
"dev": "run-s build other:watch",
"lint": "run-p test:self:fix test:lint:fix lint:fix",
"lint:fix": "prettier --write tests/**/*.{ts,tsx} src/**/*.{ts,tsx}",
"lint:fix": "prettier --write \"./tests/*.ts\" \"./src/*.ts\"",
"other:selfupdate": "updtr",
"other:watch": "nodemon -e js,ts --watch src --exec 'run-p build:dev'",
"prepublishOnly": "run-p build",
Expand Down
2 changes: 1 addition & 1 deletion src/rules/alphabetic-order.ts
Expand Up @@ -16,5 +16,5 @@ export default {

return Object.keys(sorted).join("|") === Object.keys(scripts).join("|");
},
fix: (scripts: PackageScripts) => sortScripts(scripts)
fix: (scripts: PackageScripts) => sortScripts(scripts),
};
2 changes: 1 addition & 1 deletion src/rules/correct-casing.ts
Expand Up @@ -4,5 +4,5 @@ export default {
name: "correct-casing",
isObjectRule: false,
message: 'script name "{{name}}" must be camel case',
validate: (key: string) => NAME_REGEX.test(key)
validate: (key: string) => NAME_REGEX.test(key),
};
2 changes: 1 addition & 1 deletion src/rules/index.ts
Expand Up @@ -28,7 +28,7 @@ const rules: Array<Rule> = [
/ & /,
"unix single ampersand (&)",
"npm-run-all/run-p"
)
),
];

export default rules;
2 changes: 1 addition & 1 deletion src/rules/mandatoryScriptFactory.ts
Expand Up @@ -4,5 +4,5 @@ export default (name: string): Rule => ({
isObjectRule: true,
name: `mandatory-${name}`,
message: `must contain a "${name}" script`,
validate: (scripts: PackageScripts) => Object.keys(scripts).includes(name)
validate: (scripts: PackageScripts) => Object.keys(scripts).includes(name),
});
2 changes: 1 addition & 1 deletion src/rules/no-aliases.ts
Expand Up @@ -5,5 +5,5 @@ export default {
isObjectRule: false,
message: "don't alias binaries, use npx/yarn instead ({{name}})",
validate: (key: string, value: string) =>
key !== value || DEFAULT_NPM_HOOKS.includes(key)
key !== value || DEFAULT_NPM_HOOKS.includes(key),
};
2 changes: 1 addition & 1 deletion src/rules/no-default-test.ts
Expand Up @@ -10,5 +10,5 @@ export default {
}

return true;
}
},
};
2 changes: 1 addition & 1 deletion src/rules/noShellSpecificsFactory.ts
Expand Up @@ -10,6 +10,6 @@ export default (regex: RegExp, name: string, alternative?: string): Rule => {
message: `Use of ${name} in script '{{name}}' is not allowed, consider using ${alternative}`,
validate: (_: string, script: string): boolean | string => {
return !regex.test(script);
}
},
};
};
6 changes: 3 additions & 3 deletions src/rules/prepost-trigger-defined.ts
Expand Up @@ -29,10 +29,10 @@ export default {
const postHooksMissing = getMissingHooks("post", scripts);

const allMissing = [
...preHooksMissing.map(s => `pre${s}`),
...postHooksMissing.map(s => `post${s}`)
...preHooksMissing.map((s) => `pre${s}`),
...postHooksMissing.map((s) => `post${s}`),
];

return allMissing.length < 1 ? true : allMissing;
}
},
};
6 changes: 3 additions & 3 deletions src/rules/uses-allowed-namespace.ts
@@ -1,8 +1,8 @@
import { NAMESPACES, DEFAULT_NPM_HOOKS } from "../constants";

const validate = (key: string): boolean =>
NAMESPACES.some(n => key === n) ||
NAMESPACES.some(n => key.startsWith(`${n}:`)) ||
NAMESPACES.some((n) => key === n) ||
NAMESPACES.some((n) => key.startsWith(`${n}:`)) ||
DEFAULT_NPM_HOOKS.includes(key) ||
(key.startsWith("pre") && validate(key.slice(3))) ||
(key.startsWith("post") && validate(key.slice(4)));
Expand All @@ -13,5 +13,5 @@ export default {
message:
'script name "{{name}}" should start with one of the allowed namespaces',
validate,
fix: (key: string, value: string) => [`other:${key}`, value]
fix: (key: string, value: string) => [`other:${key}`, value],
};
2 changes: 1 addition & 1 deletion tests/rules/alphabetic-order.test.ts
@@ -1,4 +1,4 @@
import rule, {sortScripts} from "../../src/rules/alphabetic-order";
import rule, { sortScripts } from "../../src/rules/alphabetic-order";

describe("alphabetic-order.ts", () => {
const invalidScripts = {
Expand Down

0 comments on commit 1820e06

Please sign in to comment.