@tsed/cli-plugin-eslint 3.18.0 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/hooks/EslintInitHook.js +11 -10
- package/lib/hooks/EslintInitHook.js.map +1 -1
- package/package.json +3 -3
- package/templates/init/.eslintrc.hbs +6 -5
- package/templates/init/.prettierrc.hbs +7 -3
- package/templates/init/lint-staged.config.js.hbs +4 -0
- package/templates/init/.lintstagedrc.hbs +0 -7
|
@@ -18,7 +18,12 @@ let EslintInitHook = class EslintInitHook {
|
|
|
18
18
|
task: (ctx) => {
|
|
19
19
|
return this.rootRenderer.renderAll([
|
|
20
20
|
".eslintrc.hbs",
|
|
21
|
-
ctx.lintstaged && ".
|
|
21
|
+
ctx.lintstaged && ".husky/_/.gitignore.hbs",
|
|
22
|
+
ctx.lintstaged && ".husky/_/husky.sh.hbs",
|
|
23
|
+
ctx.lintstaged && ".husky/.gitignore.hbs",
|
|
24
|
+
ctx.lintstaged && ".husky/post-commit.hbs",
|
|
25
|
+
ctx.lintstaged && ".husky/pre-commit.hbs",
|
|
26
|
+
ctx.lintstaged && "lint-staged.config.js.hbs",
|
|
22
27
|
ctx.prettier && ".prettierignore.hbs",
|
|
23
28
|
ctx.prettier && ".prettierrc.hbs"
|
|
24
29
|
], ctx, {
|
|
@@ -30,12 +35,13 @@ let EslintInitHook = class EslintInitHook {
|
|
|
30
35
|
}
|
|
31
36
|
addScripts(ctx) {
|
|
32
37
|
this.packageJson.addScripts({
|
|
33
|
-
"test:lint": "eslint
|
|
34
|
-
"test:lint:fix": "eslint
|
|
38
|
+
"test:lint": "eslint '**/*.{ts,js}'",
|
|
39
|
+
"test:lint:fix": "eslint '**/*.{ts,js}' --fix"
|
|
35
40
|
});
|
|
36
41
|
if (ctx.prettier) {
|
|
37
42
|
this.packageJson.addScripts({
|
|
38
|
-
prettier: "prettier '{
|
|
43
|
+
prettier: "prettier '**/*.{ts,js,json,md,yml,yaml}' --write",
|
|
44
|
+
prepare: "is-ci || husky install"
|
|
39
45
|
});
|
|
40
46
|
}
|
|
41
47
|
}
|
|
@@ -52,15 +58,10 @@ let EslintInitHook = class EslintInitHook {
|
|
|
52
58
|
}, ctx);
|
|
53
59
|
if (ctx.lintstaged) {
|
|
54
60
|
this.packageJson.addDevDependencies({
|
|
61
|
+
"is-ci": "latest",
|
|
55
62
|
husky: "latest",
|
|
56
63
|
"lint-staged": "latest"
|
|
57
64
|
}, ctx);
|
|
58
|
-
this.packageJson.add("husky", {
|
|
59
|
-
hooks: {
|
|
60
|
-
"pre-commit": "lint-staged",
|
|
61
|
-
"post-commit": "git update-index --again"
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
65
|
}
|
|
65
66
|
if (ctx.prettier) {
|
|
66
67
|
this.packageJson.addDevDependencies({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EslintInitHook.js","sourceRoot":"","sources":["../../src/hooks/EslintInitHook.ts"],"names":[],"mappings":";;;;AACA,6CAAmG;AACnG,sDAAkD;AAGlD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAQzB,MAAM,CAAC,GAAmB;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACf,OAAO,EAAE,CAAC;SACX;QAED,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAE7B,OAAO;YACL;gBACE,KAAK,EAAE,2BAA2B;gBAClC,IAAI,EAAE,CAAC,GAAQ,EAAE,EAAE;oBACjB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAChC;wBACE,eAAe;wBACf,GAAG,CAAC,UAAU,IAAI,
|
|
1
|
+
{"version":3,"file":"EslintInitHook.js","sourceRoot":"","sources":["../../src/hooks/EslintInitHook.ts"],"names":[],"mappings":";;;;AACA,6CAAmG;AACnG,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CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB,CAAC,GAAmB;QACpC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CACjC;YACE,MAAM,EAAE,QAAQ;YAChB,wBAAwB,EAAE,QAAQ;YAClC,wBAAwB,EAAE,QAAQ;YAClC,2BAA2B,EAAE,QAAQ;YACrC,kCAAkC,EAAE,QAAQ;SAC7C,EACD,GAAG,CACJ,CAAC;QAEF,IAAI,GAAG,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,kBAAkB,CACjC;gBACE,OAAO,EAAE,QAAQ;gBACjB,KAAK,EAAE,QAAQ;gBACf,aAAa,EAAE,QAAQ;aACxB,EACD,GAAG,CACJ,CAAC;SACH;QAED,IAAI,GAAG,CAAC,QAAQ,EAAE;YAChB,IAAI,CAAC,WAAW,CAAC,kBAAkB,CACjC;gBACE,QAAQ,EAAE,QAAQ;aACnB,EACD,GAAG,CACJ,CAAC;SACH;IACH,CAAC;CACF,CAAA;AA3FC;IADC,iBAAM,EAAE;sCACc,6BAAkB;mDAAC;AAG1C;IADC,iBAAM,EAAE;sCACe,8BAAmB;oDAAC;AAG5C;IADC,iBAAM,CAAC,MAAM,CAAC;;;;4CAkCd;AAzCU,cAAc;IAD1B,qBAAU,EAAE;GACA,cAAc,CA6F1B;AA7FY,wCAAc","sourcesContent":["import {InitCmdContext} from \"@tsed/cli\";\nimport {Inject, Injectable, OnExec, ProjectPackageJson, RootRendererService} from \"@tsed/cli-core\";\nimport {TEMPLATE_DIR} from \"../utils/templateDir\";\n\n@Injectable()\nexport class EslintInitHook {\n @Inject()\n protected packageJson: ProjectPackageJson;\n\n @Inject()\n protected rootRenderer: RootRendererService;\n\n @OnExec(\"init\")\n onExec(ctx: InitCmdContext) {\n if (!ctx.eslint) {\n return [];\n }\n\n this.addScripts(ctx);\n this.addDependencies(ctx);\n this.addDevDependencies(ctx);\n\n return [\n {\n title: \"Generate files for eslint\",\n task: (ctx: any) => {\n return this.rootRenderer.renderAll(\n [\n \".eslintrc.hbs\",\n ctx.lintstaged && \".husky/_/.gitignore.hbs\",\n ctx.lintstaged && \".husky/_/husky.sh.hbs\",\n ctx.lintstaged && \".husky/.gitignore.hbs\",\n ctx.lintstaged && \".husky/post-commit.hbs\",\n ctx.lintstaged && \".husky/pre-commit.hbs\",\n ctx.lintstaged && \"lint-staged.config.js.hbs\",\n ctx.prettier && \".prettierignore.hbs\",\n ctx.prettier && \".prettierrc.hbs\"\n ],\n ctx,\n {\n templateDir: `${TEMPLATE_DIR}/init`\n }\n );\n }\n }\n ];\n }\n\n addScripts(ctx: InitCmdContext) {\n this.packageJson.addScripts({\n \"test:lint\": \"eslint '**/*.{ts,js}'\",\n \"test:lint:fix\": \"eslint '**/*.{ts,js}' --fix\"\n });\n\n if (ctx.prettier) {\n this.packageJson.addScripts({\n prettier: \"prettier '**/*.{ts,js,json,md,yml,yaml}' --write\",\n prepare: \"is-ci || husky install\"\n });\n }\n }\n\n addDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies({}, ctx);\n }\n\n addDevDependencies(ctx: InitCmdContext) {\n this.packageJson.addDevDependencies(\n {\n eslint: \"latest\",\n \"eslint-config-prettier\": \"latest\",\n \"eslint-plugin-prettier\": \"latest\",\n \"@typescript-eslint/parser\": \"latest\",\n \"@typescript-eslint/eslint-plugin\": \"latest\"\n },\n ctx\n );\n\n if (ctx.lintstaged) {\n this.packageJson.addDevDependencies(\n {\n \"is-ci\": \"latest\",\n husky: \"latest\",\n \"lint-staged\": \"latest\"\n },\n ctx\n );\n }\n\n if (ctx.prettier) {\n this.packageJson.addDevDependencies(\n {\n prettier: \"latest\"\n },\n ctx\n );\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli-plugin-eslint",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"typings": "./lib/index.d.ts",
|
|
6
6
|
"description": "Ts.ED CLI plugin. Add EsLint support",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@tsed/cli": "3.
|
|
9
|
-
"@tsed/cli-core": "3.
|
|
8
|
+
"@tsed/cli": "3.19.0",
|
|
9
|
+
"@tsed/cli-core": "3.19.0"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsc --build tsconfig.compile.json",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"parser": "@typescript-eslint/parser",
|
|
3
|
-
"extends": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"plugin:prettier/recommended"{{/if}}
|
|
3
|
+
"extends": [{{#if prettier}}
|
|
4
|
+
"prettier",{{/if}}
|
|
5
|
+
"plugin:@typescript-eslint/recommended"
|
|
7
6
|
],
|
|
7
|
+
"plugins": ["@typescript-eslint"],
|
|
8
8
|
"parserOptions": {
|
|
9
|
-
|
|
9
|
+
"ecmaVersion": 2018,
|
|
10
10
|
"sourceType": "module",
|
|
11
11
|
"project": "./tsconfig.json"
|
|
12
12
|
},
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"es6": true
|
|
16
16
|
},
|
|
17
17
|
"rules": {
|
|
18
|
+
"@typescript-eslint/no-inferrable-types": 0,
|
|
18
19
|
"@typescript-eslint/no-unused-vars": 2,
|
|
19
20
|
"@typescript-eslint/no-var-requires": 0
|
|
20
21
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"printWidth": 140,
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"singleQuote": false,
|
|
4
|
+
"jsxSingleQuote": true,
|
|
5
|
+
"semi": true,
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"bracketSpacing": true,
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"trailingComma": "none"
|
|
6
10
|
}
|