@tsed/cli-plugin-eslint 5.3.1 → 6.0.0-alpha.2
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/esm/CliPluginEslintModule.js.map +1 -1
- package/lib/esm/hooks/EslintInitHook.js +6 -9
- package/lib/esm/hooks/EslintInitHook.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/templateDir.js +3 -5
- package/lib/esm/utils/templateDir.js.map +1 -1
- package/lib/types/index.d.ts +2 -2
- package/package.json +18 -18
- package/scripts/templateDir.esm.js +2 -1
- package/templates/init/eslint.config.mjs.hbs +66 -0
- package/vitest.config.mts +21 -0
- package/.eslintignore +0 -13
- package/.eslintrc.js +0 -1
- package/jest.config.js +0 -14
- package/lib/cjs/CliPluginEslintModule.js +0 -15
- package/lib/cjs/CliPluginEslintModule.js.map +0 -1
- package/lib/cjs/hooks/EslintInitHook.js +0 -126
- package/lib/cjs/hooks/EslintInitHook.js.map +0 -1
- package/lib/cjs/index.js +0 -7
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/utils/templateDir.js +0 -6
- package/lib/cjs/utils/templateDir.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/tsconfig.esm.tsbuildinfo +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/templates/init/.eslintignore.hbs +0 -1
- package/templates/init/.eslintrc.hbs +0 -22
- package/tsconfig.esm.json +0 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CliPluginEslintModule.js","sourceRoot":"","sources":["../../src/CliPluginEslintModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"CliPluginEslintModule.js","sourceRoot":"","sources":["../../src/CliPluginEslintModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAKlD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAAG,CAAA;AAAxB,qBAAqB;IAHjC,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,cAAc,CAAC;KAC1B,CAAC;GACW,qBAAqB,CAAG;SAAxB,qBAAqB"}
|
|
@@ -2,9 +2,6 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { Inject, Injectable, OnExec, OnPostInstall, PackageManagersModule, ProjectPackageJson, RootRendererService } from "@tsed/cli-core";
|
|
3
3
|
import { TEMPLATE_DIR } from "../utils/templateDir.js";
|
|
4
4
|
let EslintInitHook = class EslintInitHook {
|
|
5
|
-
packageJson;
|
|
6
|
-
packageManagers;
|
|
7
|
-
rootRenderer;
|
|
8
5
|
onExec(ctx) {
|
|
9
6
|
if (!ctx.eslint) {
|
|
10
7
|
return [];
|
|
@@ -14,8 +11,7 @@ let EslintInitHook = class EslintInitHook {
|
|
|
14
11
|
title: "Generate files for eslint",
|
|
15
12
|
task: (ctx) => {
|
|
16
13
|
return this.rootRenderer.renderAll([
|
|
17
|
-
".
|
|
18
|
-
".eslintignore.hbs",
|
|
14
|
+
"eslint.config.mjs",
|
|
19
15
|
ctx.lintstaged && ".husky/_/.gitignore.hbs",
|
|
20
16
|
ctx.lintstaged && ".husky/_/husky.sh.hbs",
|
|
21
17
|
ctx.lintstaged && ".husky/.gitignore.hbs",
|
|
@@ -63,7 +59,7 @@ let EslintInitHook = class EslintInitHook {
|
|
|
63
59
|
});
|
|
64
60
|
if (ctx.prettier) {
|
|
65
61
|
this.packageJson.addScripts({
|
|
66
|
-
prettier: "prettier '**/*.{
|
|
62
|
+
prettier: "prettier '**/*.{json,md,yml,yaml}' --write"
|
|
67
63
|
});
|
|
68
64
|
}
|
|
69
65
|
}
|
|
@@ -72,11 +68,12 @@ let EslintInitHook = class EslintInitHook {
|
|
|
72
68
|
}
|
|
73
69
|
addDevDependencies(ctx) {
|
|
74
70
|
this.packageJson.addDevDependencies({
|
|
75
|
-
eslint: "
|
|
71
|
+
"@typescript-eslint/parser": "latest",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "latest",
|
|
73
|
+
eslint: "latest",
|
|
76
74
|
"eslint-config-prettier": "latest",
|
|
77
75
|
"eslint-plugin-prettier": "latest",
|
|
78
|
-
"
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "latest"
|
|
76
|
+
"eslint-plugin-simple-import-sort": "latest"
|
|
80
77
|
}, ctx);
|
|
81
78
|
if (ctx.lintstaged) {
|
|
82
79
|
this.packageJson.addDevDependencies({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EslintInitHook.js","sourceRoot":"","sources":["../../../src/hooks/EslintInitHook.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"EslintInitHook.js","sourceRoot":"","sources":["../../../src/hooks/EslintInitHook.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAEzI,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAG9C,IAAM,cAAc,GAApB,MAAM,cAAc;IAWzB,MAAM,CAAC,GAAmB;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACf,OAAO,EAAE,CAAC;SACX;QAED,OAAO;YACL;gBACE,KAAK,EAAE,2BAA2B;gBAClC,IAAI,EAAE,CAAC,GAAQ,EAAE,EAAE;oBACjB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAChC;wBACE,mBAAmB;wBACnB,GAAG,CAAC,UAAU,IAAI,yBA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AAO,EAAC,qBAAqB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAEjE,cAAc,wBAAwB,CAAC;AAEvC,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {getTemplateDirectory} from "@tsed/cli-core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const TEMPLATE_DIR = getTemplateDirectory(path.dirname(fileURLToPath(import.meta.url)));
|
|
1
|
+
import { getTemplateDirectory } from "@tsed/cli-core";
|
|
2
|
+
export const TEMPLATE_DIR = getTemplateDirectory(import.meta.dirname);
|
|
3
|
+
//# sourceMappingURL=templateDir.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateDir.js","sourceRoot":"","sources":["../../../src/utils/templateDir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"templateDir.js","sourceRoot":"","sources":["../../../src/utils/templateDir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CliPluginEslintModule } from "./CliPluginEslintModule";
|
|
2
|
-
export * from "./utils/templateDir";
|
|
1
|
+
import { CliPluginEslintModule } from "./CliPluginEslintModule.js";
|
|
2
|
+
export * from "./utils/templateDir.js";
|
|
3
3
|
export default CliPluginEslintModule;
|
package/package.json
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli-plugin-eslint",
|
|
3
|
-
"version": "5.3.1",
|
|
4
3
|
"description": "Ts.ED CLI plugin. Add EsLint support",
|
|
4
|
+
"version": "6.0.0-alpha.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/esm/index.js",
|
|
5
7
|
"source": "./src/index.ts",
|
|
6
|
-
"main": "./lib/cjs/index.js",
|
|
7
8
|
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"default": "./lib/esm/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "yarn build:ts",
|
|
17
|
-
"build:ts": "tsc --build tsconfig.json
|
|
18
|
-
"lint": "eslint '**/*.{ts,js}'",
|
|
19
|
-
"lint:fix": "eslint '**/*.{ts,js}' --fix",
|
|
20
|
-
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2 --passWithNoTests && jest-coverage-thresholds-bumper"
|
|
19
|
+
"build:ts": "tsc --build tsconfig.json"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@tsed/cli": "
|
|
24
|
-
"@tsed/cli-core": "
|
|
25
|
-
"@tsed/
|
|
26
|
-
"@tsed/jest-config": "5.3.1",
|
|
27
|
-
"@tsed/typescript": "5.3.1",
|
|
22
|
+
"@tsed/cli": "6.0.0-alpha.2",
|
|
23
|
+
"@tsed/cli-core": "6.0.0-alpha.2",
|
|
24
|
+
"@tsed/typescript": "6.0.0-alpha.2",
|
|
28
25
|
"cross-env": "7.0.3",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
26
|
+
"typescript": "4.9.5",
|
|
27
|
+
"vitest": "2.1.1"
|
|
31
28
|
},
|
|
32
29
|
"dependencies": {
|
|
33
30
|
"tslib": "2.3.1"
|
|
@@ -39,5 +36,8 @@
|
|
|
39
36
|
},
|
|
40
37
|
"homepage": "https://github.com/tsedio/tsed-cli/tree/master/packages/cli-plugin-eslint",
|
|
41
38
|
"author": "Romain Lenzotti",
|
|
42
|
-
"license": "MIT"
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"tag": "alpha"
|
|
42
|
+
}
|
|
43
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {getTemplateDirectory} from "@tsed/cli-core";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import {fileURLToPath} from "node:url";
|
|
4
3
|
|
|
4
|
+
import {getTemplateDirectory} from "@tsed/cli-core";
|
|
5
|
+
|
|
5
6
|
export const TEMPLATE_DIR = getTemplateDirectory(path.dirname(fileURLToPath(import.meta.url)));
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
|
2
|
+
import typescriptParser from "@typescript-eslint/parser";
|
|
3
|
+
{{#if prettier}}import pluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
4
|
+
{{/if}}import pluginSimpleImportSort from "eslint-plugin-simple-import-sort";
|
|
5
|
+
{{#if vitest}}import vitest from "eslint-plugin-vitest";
|
|
6
|
+
i{{/if}}import globals from "globals";
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
ignores: ["coverage", "dist", "processes.config.js", "**/templates"]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
ecmaVersion: "latest",
|
|
16
|
+
sourceType: "module",
|
|
17
|
+
parser: typescriptParser,
|
|
18
|
+
parserOptions: {
|
|
19
|
+
ecmaVersion: "latest",
|
|
20
|
+
sourceType: "module"
|
|
21
|
+
},
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.node
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
plugins: {
|
|
27
|
+
"@typescript-eslint": typescriptEslint
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
30
|
+
"@typescript-eslint/ban-ts-comment": 0,
|
|
31
|
+
"@typescript-eslint/camelcase": 0,
|
|
32
|
+
"@typescript-eslint/no-inferrable-types": 0,
|
|
33
|
+
"@typescript-eslint/explicit-function-return-type": 0,
|
|
34
|
+
"@typescript-eslint/explicit-module-boundary-types": 0,
|
|
35
|
+
"@typescript-eslint/no-unused-vars": 0,
|
|
36
|
+
"@typescript-eslint/no-explicit-any": 0,
|
|
37
|
+
"@typescript-eslint/no-non-null-assertion": 0
|
|
38
|
+
}
|
|
39
|
+
},{{#if vitest}}
|
|
40
|
+
{
|
|
41
|
+
files: ["**/*.spec.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], // or any other pattern
|
|
42
|
+
plugins: {
|
|
43
|
+
vitest
|
|
44
|
+
},
|
|
45
|
+
rules: {
|
|
46
|
+
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules
|
|
47
|
+
"vitest/consistent-test-it": ["error", {fn: "it", withinDescribe: "it"}],
|
|
48
|
+
"vitest/no-alias-methods": "error"
|
|
49
|
+
}
|
|
50
|
+
},{{/if}}
|
|
51
|
+
{
|
|
52
|
+
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
53
|
+
languageOptions: {
|
|
54
|
+
parserOptions: {}
|
|
55
|
+
},
|
|
56
|
+
plugins: {
|
|
57
|
+
"simple-import-sort": pluginSimpleImportSort
|
|
58
|
+
},
|
|
59
|
+
rules: {
|
|
60
|
+
"simple-import-sort/imports": "error",
|
|
61
|
+
"simple-import-sort/exports": "error",
|
|
62
|
+
"workspaces/no-absolute-imports": "error"
|
|
63
|
+
}
|
|
64
|
+
}{{#if prettier}},
|
|
65
|
+
pluginPrettierRecommended{{/if}}
|
|
66
|
+
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
coverage: {
|
|
11
|
+
...presets.test.coverage,
|
|
12
|
+
thresholds: {
|
|
13
|
+
statements: 0,
|
|
14
|
+
branches: 0,
|
|
15
|
+
functions: 0,
|
|
16
|
+
lines: 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("@tsed/eslint/node.js");
|
package/jest.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
...require("@tsed/jest-config"),
|
|
6
|
-
coverageThreshold: {
|
|
7
|
-
global: {
|
|
8
|
-
statements: 0,
|
|
9
|
-
branches: 0,
|
|
10
|
-
functions: 0,
|
|
11
|
-
lines: 0
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CliPluginEslintModule = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
6
|
-
const EslintInitHook_1 = require("./hooks/EslintInitHook");
|
|
7
|
-
let CliPluginEslintModule = class CliPluginEslintModule {
|
|
8
|
-
};
|
|
9
|
-
CliPluginEslintModule = tslib_1.__decorate([
|
|
10
|
-
(0, cli_core_1.Module)({
|
|
11
|
-
imports: [EslintInitHook_1.EslintInitHook]
|
|
12
|
-
})
|
|
13
|
-
], CliPluginEslintModule);
|
|
14
|
-
exports.CliPluginEslintModule = CliPluginEslintModule;
|
|
15
|
-
//# sourceMappingURL=CliPluginEslintModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CliPluginEslintModule.js","sourceRoot":"","sources":["../../src/CliPluginEslintModule.ts"],"names":[],"mappings":";;;;AAAA,6CAAsC;AACtC,2DAAsD;AAK/C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAAG,CAAA;AAAxB,qBAAqB;IAHjC,IAAA,iBAAM,EAAC;QACN,OAAO,EAAE,CAAC,+BAAc,CAAC;KAC1B,CAAC;GACW,qBAAqB,CAAG;AAAxB,sDAAqB"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EslintInitHook = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
6
|
-
const templateDir_1 = require("../utils/templateDir");
|
|
7
|
-
let EslintInitHook = class EslintInitHook {
|
|
8
|
-
packageJson;
|
|
9
|
-
packageManagers;
|
|
10
|
-
rootRenderer;
|
|
11
|
-
onExec(ctx) {
|
|
12
|
-
if (!ctx.eslint) {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
return [
|
|
16
|
-
{
|
|
17
|
-
title: "Generate files for eslint",
|
|
18
|
-
task: (ctx) => {
|
|
19
|
-
return this.rootRenderer.renderAll([
|
|
20
|
-
".eslintrc.hbs",
|
|
21
|
-
".eslintignore.hbs",
|
|
22
|
-
ctx.lintstaged && ".husky/_/.gitignore.hbs",
|
|
23
|
-
ctx.lintstaged && ".husky/_/husky.sh.hbs",
|
|
24
|
-
ctx.lintstaged && ".husky/.gitignore.hbs",
|
|
25
|
-
ctx.lintstaged && ".husky/post-commit.hbs",
|
|
26
|
-
ctx.lintstaged && ".husky/pre-commit.hbs",
|
|
27
|
-
ctx.lintstaged && ".lintstagedrc.json.hbs",
|
|
28
|
-
ctx.prettier && ".prettierignore.hbs",
|
|
29
|
-
ctx.prettier && ".prettierrc.hbs"
|
|
30
|
-
], ctx, {
|
|
31
|
-
templateDir: `${templateDir_1.TEMPLATE_DIR}/init`
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: "Add dependencies",
|
|
37
|
-
task: () => {
|
|
38
|
-
this.addScripts(ctx);
|
|
39
|
-
this.addDependencies(ctx);
|
|
40
|
-
this.addDevDependencies(ctx);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
onPostInstall(ctx) {
|
|
46
|
-
return [
|
|
47
|
-
{
|
|
48
|
-
title: "Add husky prepare task",
|
|
49
|
-
skip: !ctx.lintstaged,
|
|
50
|
-
task: async () => {
|
|
51
|
-
this.packageJson
|
|
52
|
-
.refresh()
|
|
53
|
-
.addScripts({
|
|
54
|
-
prepare: "is-ci || husky install"
|
|
55
|
-
})
|
|
56
|
-
.write();
|
|
57
|
-
await this.packageManagers.runScript("prepare");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
addScripts(ctx) {
|
|
63
|
-
this.packageJson.addScripts({
|
|
64
|
-
"test:lint": "eslint '**/*.{ts,js}'",
|
|
65
|
-
"test:lint:fix": "eslint '**/*.{ts,js}' --fix"
|
|
66
|
-
});
|
|
67
|
-
if (ctx.prettier) {
|
|
68
|
-
this.packageJson.addScripts({
|
|
69
|
-
prettier: "prettier '**/*.{ts,js,json,md,yml,yaml}' --write"
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
addDependencies(ctx) {
|
|
74
|
-
this.packageJson.addDependencies({}, ctx);
|
|
75
|
-
}
|
|
76
|
-
addDevDependencies(ctx) {
|
|
77
|
-
this.packageJson.addDevDependencies({
|
|
78
|
-
eslint: "8",
|
|
79
|
-
"eslint-config-prettier": "latest",
|
|
80
|
-
"eslint-plugin-prettier": "latest",
|
|
81
|
-
"@typescript-eslint/parser": "latest",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "latest"
|
|
83
|
-
}, ctx);
|
|
84
|
-
if (ctx.lintstaged) {
|
|
85
|
-
this.packageJson.addDevDependencies({
|
|
86
|
-
"is-ci": "latest",
|
|
87
|
-
husky: "latest",
|
|
88
|
-
"lint-staged": "latest"
|
|
89
|
-
}, ctx);
|
|
90
|
-
}
|
|
91
|
-
if (ctx.prettier) {
|
|
92
|
-
this.packageJson.addDevDependencies({
|
|
93
|
-
prettier: "latest"
|
|
94
|
-
}, ctx);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
tslib_1.__decorate([
|
|
99
|
-
(0, cli_core_1.Inject)(),
|
|
100
|
-
tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
|
|
101
|
-
], EslintInitHook.prototype, "packageJson", void 0);
|
|
102
|
-
tslib_1.__decorate([
|
|
103
|
-
(0, cli_core_1.Inject)(),
|
|
104
|
-
tslib_1.__metadata("design:type", cli_core_1.PackageManagersModule)
|
|
105
|
-
], EslintInitHook.prototype, "packageManagers", void 0);
|
|
106
|
-
tslib_1.__decorate([
|
|
107
|
-
(0, cli_core_1.Inject)(),
|
|
108
|
-
tslib_1.__metadata("design:type", cli_core_1.RootRendererService)
|
|
109
|
-
], EslintInitHook.prototype, "rootRenderer", void 0);
|
|
110
|
-
tslib_1.__decorate([
|
|
111
|
-
(0, cli_core_1.OnExec)("init"),
|
|
112
|
-
tslib_1.__metadata("design:type", Function),
|
|
113
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
114
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
115
|
-
], EslintInitHook.prototype, "onExec", null);
|
|
116
|
-
tslib_1.__decorate([
|
|
117
|
-
(0, cli_core_1.OnPostInstall)("init"),
|
|
118
|
-
tslib_1.__metadata("design:type", Function),
|
|
119
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
120
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
121
|
-
], EslintInitHook.prototype, "onPostInstall", null);
|
|
122
|
-
EslintInitHook = tslib_1.__decorate([
|
|
123
|
-
(0, cli_core_1.Injectable)()
|
|
124
|
-
], EslintInitHook);
|
|
125
|
-
exports.EslintInitHook = EslintInitHook;
|
|
126
|
-
//# sourceMappingURL=EslintInitHook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EslintInitHook.js","sourceRoot":"","sources":["../../../src/hooks/EslintInitHook.ts"],"names":[],"mappings":";;;;AACA,6CAAyI;AACzI,sDAAkD;AAG3C,IAAM,cAAc,GAApB,MAAM,cAAc;IAEf,WAAW,CAAqB;IAGhC,eAAe,CAAwB;IAGvC,YAAY,CAAsB;IAG5C,MAAM,CAAC,GAAmB;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACf,OAAO,EAAE,CAAC;SACX;QAED,OAAO;YACL;gBACE,KAAK,EAAE,2BAA2B;gBAClC,IAAI,EAAE,CAAC,GAAQ,EAAE,EAAE;oBACjB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAChC;wBACE,eAAe;wBACf,mBAAmB;wBACnB,GAAG,CAAC,UAAU,IAAI,yBAAyB;wBAC3C,GAAG,CAAC,UAAU,IAAI,uBAAuB;wBACzC,GAAG,CAAC,UAAU,IAAI,uBAAuB;wBACzC,GAAG,CAAC,UAAU,IAAI,wBAAwB;wBAC1C,GAAG,CAAC,UAAU,IAAI,uBAAuB;wBACzC,GAAG,CAAC,UAAU,IAAI,wBAAwB;wBAC1C,GAAG,CAAC,QAAQ,IAAI,qBAAqB;w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kB,CACjC;YACE,MAAM,EAAE,GAAG;YACX,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;AAvHC;IAAC,IAAA,iBAAM,GAAE;sCACc,6BAAkB;mDAAC;AAE1C;IAAC,IAAA,iBAAM,GAAE;sCACkB,gCAAqB;uDAAC;AAEjD;IAAC,IAAA,iBAAM,GAAE;sCACe,8BAAmB;oDAAC;AAE5C;IAAC,IAAA,iBAAM,EAAC,MAAM,CAAC;;;;4CAuCd;AAED;IAAC,IAAA,wBAAa,EAAC,MAAM,CAAC;;;;mDAkBrB;AArEU,cAAc;IAD1B,IAAA,qBAAU,GAAE;GACA,cAAc,CAwH1B;AAxHY,wCAAc"}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const CliPluginEslintModule_1 = require("./CliPluginEslintModule");
|
|
5
|
-
tslib_1.__exportStar(require("./utils/templateDir"), exports);
|
|
6
|
-
exports.default = CliPluginEslintModule_1.CliPluginEslintModule;
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mEAA8D;AAE9D,8DAAoC;AAEpC,kBAAe,6CAAqB,CAAC"}
|
package/lib/cjs/package.json
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEMPLATE_DIR = void 0;
|
|
4
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
5
|
-
exports.TEMPLATE_DIR = (0, cli_core_1.getTemplateDirectory)(__dirname);
|
|
6
|
-
//# sourceMappingURL=templateDir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateDir.js","sourceRoot":"","sources":["../../../src/utils/templateDir.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAEvC,QAAA,YAAY,GAAG,IAAA,+BAAoB,EAAC,SAAS,CAAC,CAAC"}
|
package/lib/esm/package.json
DELETED