@futdevpro/dynamo-eslint 1.12.1 → 1.14.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/.github/workflows/main.yml +1 -2
- package/README.md +34 -0
- package/build/configs/base.d.ts +7 -3
- package/build/configs/base.d.ts.map +1 -1
- package/build/configs/base.js +9 -4
- package/build/configs/base.js.map +1 -1
- package/build/configs/fsm.d.ts +13 -9
- package/build/configs/fsm.d.ts.map +1 -1
- package/build/configs/fsm.js +6 -2
- package/build/configs/fsm.js.map +1 -1
- package/build/configs/ngx-package.d.ts +8 -3
- package/build/configs/ngx-package.d.ts.map +1 -1
- package/build/configs/ngx-package.js +4 -0
- package/build/configs/ngx-package.js.map +1 -1
- package/build/configs/ngx.d.ts +8 -3
- package/build/configs/ngx.d.ts.map +1 -1
- package/build/configs/ngx.js +4 -0
- package/build/configs/ngx.js.map +1 -1
- package/build/configs/nts-package.d.ts +8 -3
- package/build/configs/nts-package.d.ts.map +1 -1
- package/build/configs/nts-package.js +4 -0
- package/build/configs/nts-package.js.map +1 -1
- package/build/configs/nts.d.ts +8 -3
- package/build/configs/nts.d.ts.map +1 -1
- package/build/configs/nts.js +4 -0
- package/build/configs/nts.js.map +1 -1
- package/build/plugin/index.d.ts +4 -0
- package/build/plugin/index.d.ts.map +1 -1
- package/build/plugin/index.js +7 -1
- package/build/plugin/index.js.map +1 -1
- package/build/plugin/rules/import/import-order.d.ts +4 -0
- package/build/plugin/rules/import/import-order.d.ts.map +1 -0
- package/build/plugin/rules/{import-order.js → import/import-order.js} +16 -17
- package/build/plugin/rules/import/import-order.js.map +1 -0
- package/build/plugin/rules/import/import-order.spec.d.ts.map +1 -0
- package/build/plugin/rules/{import-order.spec.js → import/import-order.spec.js} +40 -40
- package/build/plugin/rules/import/import-order.spec.js.map +1 -0
- package/build/plugin/rules/import/no-import-type.d.ts +4 -0
- package/build/plugin/rules/import/no-import-type.d.ts.map +1 -0
- package/build/plugin/rules/import/no-import-type.js +35 -0
- package/build/plugin/rules/import/no-import-type.js.map +1 -0
- package/build/plugin/rules/import/no-import-type.spec.d.ts +2 -0
- package/build/plugin/rules/import/no-import-type.spec.d.ts.map +1 -0
- package/build/plugin/rules/import/no-import-type.spec.js +60 -0
- package/build/plugin/rules/import/no-import-type.spec.js.map +1 -0
- package/build/plugin/rules/import/no-js-import.d.ts +4 -0
- package/build/plugin/rules/import/no-js-import.d.ts.map +1 -0
- package/build/plugin/rules/import/no-js-import.js +33 -0
- package/build/plugin/rules/import/no-js-import.js.map +1 -0
- package/build/plugin/rules/import/no-js-import.spec.d.ts +2 -0
- package/build/plugin/rules/import/no-js-import.spec.d.ts.map +1 -0
- package/build/plugin/rules/import/no-js-import.spec.js +68 -0
- package/build/plugin/rules/import/no-js-import.spec.js.map +1 -0
- package/build/plugin/rules/naming-patterns.d.ts +1 -1
- package/build/plugin/rules/naming-patterns.d.ts.map +1 -1
- package/build/plugin/rules/naming-patterns.spec.js +1 -1
- package/build/plugin/rules/naming-patterns.spec.js.map +1 -1
- package/build/scripts/dynamo-fix.d.ts +3 -0
- package/build/scripts/dynamo-fix.d.ts.map +1 -0
- package/build/scripts/dynamo-fix.js +92 -0
- package/build/scripts/dynamo-fix.js.map +1 -0
- package/build/scripts/eslintrc-audit.js.map +1 -1
- package/build/scripts/fix-return-types.d.ts +3 -0
- package/build/scripts/fix-return-types.d.ts.map +1 -0
- package/build/scripts/fix-return-types.js +109 -0
- package/build/scripts/fix-return-types.js.map +1 -0
- package/build/scripts/validate-imports.js +10 -9
- package/build/scripts/validate-imports.js.map +1 -1
- package/build/scripts/validate-naming.js +11 -26
- package/build/scripts/validate-naming.js.map +1 -1
- package/build-test/plugin/rules/import-order.d.ts +1 -1
- package/build-test/plugin/rules/naming-patterns.d.ts +1 -1
- package/eslint.config.js +55 -0
- package/futdevpro-dynamo-eslint-01.14.2.tgz +0 -0
- package/package.json +27 -18
- package/samples/poc-violations.ts +32 -3
- package/src/configs/base.ts +14 -4
- package/src/configs/fsm.ts +6 -2
- package/src/configs/ngx-package.ts +4 -0
- package/src/configs/ngx.ts +4 -0
- package/src/configs/nts-package.ts +4 -0
- package/src/configs/nts.ts +5 -1
- package/src/plugin/index.ts +9 -1
- package/src/plugin/rules/{import-order.spec.ts → import/import-order.spec.ts} +46 -40
- package/src/plugin/rules/{import-order.ts → import/import-order.ts} +20 -18
- package/src/plugin/rules/import/no-import-type.spec.ts +69 -0
- package/src/plugin/rules/import/no-import-type.ts +37 -0
- package/src/plugin/rules/import/no-js-import.spec.ts +82 -0
- package/src/plugin/rules/import/no-js-import.ts +35 -0
- package/src/plugin/rules/naming-patterns.spec.ts +3 -1
- package/src/plugin/rules/naming-patterns.ts +1 -1
- package/src/scripts/dynamo-fix.ts +108 -0
- package/src/scripts/eslintrc-audit.ts +6 -2
- package/src/scripts/fix-return-types.ts +146 -0
- package/src/scripts/validate-imports.ts +95 -13
- package/src/scripts/validate-naming.ts +16 -28
- package/.eslintrc.json +0 -16
- package/INTEGRATION.md +0 -74
- package/POC-README.md +0 -147
- package/build/plugin/rules/import-order.d.ts +0 -4
- package/build/plugin/rules/import-order.d.ts.map +0 -1
- package/build/plugin/rules/import-order.js.map +0 -1
- package/build/plugin/rules/import-order.spec.d.ts.map +0 -1
- package/build/plugin/rules/import-order.spec.js.map +0 -1
- package/futdevpro-dynamo-eslint-01.12.01.tgz +0 -0
- /package/build/plugin/rules/{import-order.spec.d.ts → import/import-order.spec.d.ts} +0 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
6
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
7
|
+
const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
|
|
8
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
9
|
+
function addReturnTypesToFile(filePath) {
|
|
10
|
+
const sourceCode = fs.readFileSync(filePath, 'utf8');
|
|
11
|
+
const sourceFile = ts.createSourceFile(filePath, sourceCode, ts.ScriptTarget.Latest, true);
|
|
12
|
+
const program = ts.createProgram([filePath], {
|
|
13
|
+
target: ts.ScriptTarget.Latest,
|
|
14
|
+
module: ts.ModuleKind.ESNext,
|
|
15
|
+
strict: true,
|
|
16
|
+
skipLibCheck: true,
|
|
17
|
+
});
|
|
18
|
+
const checker = program.getTypeChecker();
|
|
19
|
+
let changes = 0;
|
|
20
|
+
let hasChanges = false;
|
|
21
|
+
function visit(node) {
|
|
22
|
+
// Handle function declarations
|
|
23
|
+
if (ts.isFunctionDeclaration(node) && !node.type) {
|
|
24
|
+
const signature = checker.getSignatureFromDeclaration(node);
|
|
25
|
+
if (signature) {
|
|
26
|
+
const returnType = checker.getReturnTypeOfSignature(signature);
|
|
27
|
+
const typeString = checker.typeToString(returnType);
|
|
28
|
+
if (typeString !== 'void' && typeString !== 'any') {
|
|
29
|
+
const newType = ts.factory.createTypeReferenceNode(typeString);
|
|
30
|
+
const updatedNode = ts.factory.updateFunctionDeclaration(node, node.modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, newType, node.body);
|
|
31
|
+
changes++;
|
|
32
|
+
hasChanges = true;
|
|
33
|
+
return ts.visitEachChild(updatedNode, visit, {});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Handle arrow functions
|
|
38
|
+
if (ts.isArrowFunction(node) && !node.type) {
|
|
39
|
+
const signature = checker.getSignatureFromDeclaration(node);
|
|
40
|
+
if (signature) {
|
|
41
|
+
const returnType = checker.getReturnTypeOfSignature(signature);
|
|
42
|
+
const typeString = checker.typeToString(returnType);
|
|
43
|
+
if (typeString !== 'void' && typeString !== 'any') {
|
|
44
|
+
const newType = ts.factory.createTypeReferenceNode(typeString);
|
|
45
|
+
const updatedNode = ts.factory.updateArrowFunction(node, node.modifiers, node.typeParameters, node.parameters, newType, node.equalsGreaterThanToken, node.body);
|
|
46
|
+
changes++;
|
|
47
|
+
hasChanges = true;
|
|
48
|
+
return ts.visitEachChild(updatedNode, visit, {});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return ts.visitEachChild(node, visit, {});
|
|
53
|
+
}
|
|
54
|
+
const result = ts.visitEachChild(sourceFile, visit, {});
|
|
55
|
+
if (hasChanges) {
|
|
56
|
+
const printer = ts.createPrinter();
|
|
57
|
+
const newSourceCode = printer.printFile(result);
|
|
58
|
+
fs.writeFileSync(filePath, newSourceCode);
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
file: filePath,
|
|
62
|
+
fixed: hasChanges,
|
|
63
|
+
changes,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function main() {
|
|
67
|
+
const files = await (0, fast_glob_1.default)(['**/*.{ts,tsx}'], {
|
|
68
|
+
ignore: [
|
|
69
|
+
'**/node_modules/**',
|
|
70
|
+
'**/build/**',
|
|
71
|
+
'**/dist/**',
|
|
72
|
+
'**/*.spec.ts',
|
|
73
|
+
'**/*.test.ts',
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
fsm_dynamo_1.DyFM_Log.log(`[fix-return-types] Processing ${files.length} files...`);
|
|
77
|
+
const results = [];
|
|
78
|
+
let totalFixed = 0;
|
|
79
|
+
let totalChanges = 0;
|
|
80
|
+
for (const file of files) {
|
|
81
|
+
try {
|
|
82
|
+
const result = addReturnTypesToFile(file);
|
|
83
|
+
results.push(result);
|
|
84
|
+
if (result.fixed) {
|
|
85
|
+
totalFixed++;
|
|
86
|
+
totalChanges += result.changes;
|
|
87
|
+
fsm_dynamo_1.DyFM_Log.log(`✅ Fixed ${result.changes} return types in ${file}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
fsm_dynamo_1.DyFM_Log.error(`❌ Error processing ${file}:`, error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
fsm_dynamo_1.DyFM_Log.log(`\n📊 Fix Summary:`);
|
|
95
|
+
fsm_dynamo_1.DyFM_Log.log(` Files processed: ${files.length}`);
|
|
96
|
+
fsm_dynamo_1.DyFM_Log.log(` Files fixed: ${totalFixed}`);
|
|
97
|
+
fsm_dynamo_1.DyFM_Log.log(` Total return types added: ${totalChanges}`);
|
|
98
|
+
if (totalFixed > 0) {
|
|
99
|
+
fsm_dynamo_1.DyFM_Log.log(`🎉 Successfully added return types to ${totalFixed} files!`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
fsm_dynamo_1.DyFM_Log.log('✅ No files needed return type fixes!');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
main().catch((err) => {
|
|
106
|
+
fsm_dynamo_1.DyFM_Log.error('Fix script failed:', err);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=fix-return-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-return-types.js","sourceRoot":"","sources":["../../src/scripts/fix-return-types.ts"],"names":[],"mappings":";;;;AACA,uDAAiC;AACjC,+CAAyB;AAEzB,kEAA2B;AAC3B,sDAAiD;AAQjD,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAE3F,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE;QAC3C,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM;QAC9B,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM;QAC5B,MAAM,EAAE,IA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qBAAQ,CAAC,GAAG,CAAC,yCAAyC,UAAU,SAAS,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACN,qBAAQ,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACvD,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,qBAAQ,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
5
6
|
const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
|
|
6
7
|
const eslint_1 = require("eslint");
|
|
7
8
|
async function validateImportsInFile(filePath) {
|
|
@@ -38,9 +39,9 @@ async function validateImportsInFile(filePath) {
|
|
|
38
39
|
}
|
|
39
40
|
async function main() {
|
|
40
41
|
const files = await (0, fast_glob_1.default)(['**/*.{ts,tsx}'], {
|
|
41
|
-
ignore: ['**/node_modules/**', '**/build/**', '**/dist/**', '**/*.spec.ts', '**/*.test.ts']
|
|
42
|
+
ignore: ['**/node_modules/**', '**/build/**', '**/dist/**', '**/*.spec.ts', '**/*.test.ts'],
|
|
42
43
|
});
|
|
43
|
-
|
|
44
|
+
fsm_dynamo_1.DyFM_Log.log(`[dynamo-validate-imports] Scanning ${files.length} files...`);
|
|
44
45
|
const results = [];
|
|
45
46
|
let totalErrors = 0;
|
|
46
47
|
for (const file of files) {
|
|
@@ -50,27 +51,27 @@ async function main() {
|
|
|
50
51
|
totalErrors += result.errors.length;
|
|
51
52
|
}
|
|
52
53
|
catch (error) {
|
|
53
|
-
|
|
54
|
+
fsm_dynamo_1.DyFM_Log.error(`Error processing ${file}:`, error);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
// Report results
|
|
57
58
|
const filesWithErrors = results.filter(r => r.errors.length > 0);
|
|
58
59
|
if (filesWithErrors.length === 0) {
|
|
59
|
-
|
|
60
|
+
fsm_dynamo_1.DyFM_Log.log('✅ All import validations passed!');
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
fsm_dynamo_1.DyFM_Log.warn(`\n❌ Found ${totalErrors} import validation errors in ${filesWithErrors.length} files:\n`);
|
|
63
64
|
filesWithErrors.forEach(result => {
|
|
64
|
-
|
|
65
|
+
fsm_dynamo_1.DyFM_Log.log(`📁 ${result.file}:`);
|
|
65
66
|
result.errors.forEach(error => {
|
|
66
|
-
|
|
67
|
+
fsm_dynamo_1.DyFM_Log.log(` ${error.line}:${error.column} - ${error.message}`);
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
fsm_dynamo_1.DyFM_Log.log('');
|
|
69
70
|
});
|
|
70
71
|
process.exit(1);
|
|
71
72
|
}
|
|
72
73
|
main().catch((err) => {
|
|
73
|
-
|
|
74
|
+
fsm_dynamo_1.DyFM_Log.error('Validation failed:', err);
|
|
74
75
|
process.exit(1);
|
|
75
76
|
});
|
|
76
77
|
//# sourceMappingURL=validate-imports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-imports.js","sourceRoot":"","sources":["../../src/scripts/validate-imports.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"validate-imports.js","sourceRoot":"","sources":["../../src/scripts/validate-imports.ts"],"names":[],"mappings":";;;;AAkFA,sDAAiD;AACjD,kEAA2B;AAC3B,mCAAgC;AAYhC,KAAK,UAAU,qBAAqB,CAAC,QAAgB;IACnD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC;QACxB,UAAU,EAAE;YACV,MAAM,EAAE,2BAA2B;YACnC,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gB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,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
|
|
6
6
|
const eslint_1 = require("eslint");
|
|
7
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
7
8
|
async function validateNamingInFile(filePath) {
|
|
8
9
|
const eslint = new eslint_1.ESLint({
|
|
9
|
-
baseConfig:
|
|
10
|
-
parser: '@typescript-eslint/parser',
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2020,
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
'@futdevpro/dynamo/naming-patterns': 'error',
|
|
17
|
-
},
|
|
18
|
-
plugins: {
|
|
19
|
-
'@futdevpro/dynamo': {
|
|
20
|
-
rules: {
|
|
21
|
-
'naming-patterns': require('../plugin/rules/naming-patterns').default,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
10
|
+
baseConfig: require('../eslint.config.js')[1], // Use the main config object from flat config array
|
|
26
11
|
});
|
|
27
12
|
const results = await eslint.lintFiles([filePath]);
|
|
28
13
|
const result = results[0];
|
|
@@ -38,9 +23,9 @@ async function validateNamingInFile(filePath) {
|
|
|
38
23
|
}
|
|
39
24
|
async function main() {
|
|
40
25
|
const files = await (0, fast_glob_1.default)(['**/*.{ts,tsx}'], {
|
|
41
|
-
ignore: ['**/node_modules/**', '**/build/**', '**/dist/**', '**/*.spec.ts', '**/*.test.ts']
|
|
26
|
+
ignore: ['**/node_modules/**', '**/build/**', '**/dist/**', '**/*.spec.ts', '**/*.test.ts'],
|
|
42
27
|
});
|
|
43
|
-
|
|
28
|
+
fsm_dynamo_1.DyFM_Log.log(`[dynamo-validate-naming] Scanning ${files.length} files...`);
|
|
44
29
|
const results = [];
|
|
45
30
|
let totalErrors = 0;
|
|
46
31
|
for (const file of files) {
|
|
@@ -50,27 +35,27 @@ async function main() {
|
|
|
50
35
|
totalErrors += result.errors.length;
|
|
51
36
|
}
|
|
52
37
|
catch (error) {
|
|
53
|
-
|
|
38
|
+
fsm_dynamo_1.DyFM_Log.error(`Error processing ${file}:`, error);
|
|
54
39
|
}
|
|
55
40
|
}
|
|
56
41
|
// Report results
|
|
57
42
|
const filesWithErrors = results.filter(r => r.errors.length > 0);
|
|
58
43
|
if (filesWithErrors.length === 0) {
|
|
59
|
-
|
|
44
|
+
fsm_dynamo_1.DyFM_Log.log('✅ All naming validations passed!');
|
|
60
45
|
return;
|
|
61
46
|
}
|
|
62
|
-
|
|
47
|
+
fsm_dynamo_1.DyFM_Log.warn(`\n❌ Found ${totalErrors} naming validation errors in ${filesWithErrors.length} files:\n`);
|
|
63
48
|
filesWithErrors.forEach(result => {
|
|
64
|
-
|
|
49
|
+
fsm_dynamo_1.DyFM_Log.log(`📁 ${result.file}:`);
|
|
65
50
|
result.errors.forEach(error => {
|
|
66
|
-
|
|
51
|
+
fsm_dynamo_1.DyFM_Log.log(` ${error.line}:${error.column} - ${error.message}`);
|
|
67
52
|
});
|
|
68
|
-
|
|
53
|
+
fsm_dynamo_1.DyFM_Log.log('');
|
|
69
54
|
});
|
|
70
55
|
process.exit(1);
|
|
71
56
|
}
|
|
72
57
|
main().catch((err) => {
|
|
73
|
-
|
|
58
|
+
fsm_dynamo_1.DyFM_Log.error('Validation failed:', err);
|
|
74
59
|
process.exit(1);
|
|
75
60
|
});
|
|
76
61
|
//# sourceMappingURL=validate-naming.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-naming.js","sourceRoot":"","sources":["../../src/scripts/validate-naming.ts"],"names":[],"mappings":";;;;AACA,kEAA2B;AAE3B,mCAAgC;
|
|
1
|
+
{"version":3,"file":"validate-naming.js","sourceRoot":"","sources":["../../src/scripts/validate-naming.ts"],"names":[],"mappings":";;;;AACA,kEAA2B;AAE3B,mCAAgC;AAEhC,sDAAiD;AAY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this package
|
|
2
|
+
// Uses nts-package ruleset with Dynamo custom rules
|
|
3
|
+
|
|
4
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
5
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
6
|
+
const unusedImportsPlugin = require('eslint-plugin-unused-imports');
|
|
7
|
+
const maxParamsNoConstructorPlugin = require('eslint-plugin-max-params-no-constructor');
|
|
8
|
+
|
|
9
|
+
// Load our plugin from build-test to avoid requiring a prior build
|
|
10
|
+
const dynamoPlugin = (function loadDynamoPlugin() {
|
|
11
|
+
try {
|
|
12
|
+
// build-test compiled output for quick iteration
|
|
13
|
+
return require('./build-test/plugin').default || require('./build-test/plugin');
|
|
14
|
+
} catch {
|
|
15
|
+
// fallback: try built output if present
|
|
16
|
+
return require('./build/plugin');
|
|
17
|
+
}
|
|
18
|
+
})();
|
|
19
|
+
|
|
20
|
+
// Load nts-package config
|
|
21
|
+
const ntsPackageConfig = require('./build/configs/nts-package');
|
|
22
|
+
|
|
23
|
+
module.exports = [
|
|
24
|
+
{
|
|
25
|
+
ignores: [
|
|
26
|
+
'build/**',
|
|
27
|
+
'dist/**',
|
|
28
|
+
'node_modules/**'
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
files: [
|
|
33
|
+
'src/**/*.ts'
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parser: tsParser,
|
|
37
|
+
parserOptions: {
|
|
38
|
+
ecmaVersion: 'latest',
|
|
39
|
+
sourceType: 'module'
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
plugins: {
|
|
43
|
+
'@typescript-eslint': tsPlugin,
|
|
44
|
+
'@futdevpro/dynamo': dynamoPlugin,
|
|
45
|
+
'unused-imports': unusedImportsPlugin,
|
|
46
|
+
'max-params-no-constructor': maxParamsNoConstructorPlugin,
|
|
47
|
+
},
|
|
48
|
+
rules: {
|
|
49
|
+
// Apply all nts-package rules (they're all compatible now!)
|
|
50
|
+
...ntsPackageConfig.rules,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/dynamo-eslint",
|
|
3
|
-
"version": "01.
|
|
3
|
+
"version": "01.14.2",
|
|
4
4
|
"description": "Shared ESLint configs, Dynamo-powered plugin and validators for FutDevPro stacks",
|
|
5
5
|
"author": "Future Development Program Ltd.",
|
|
6
6
|
"license": "ISC",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"prep": "npm i -g pnpm rimraf nodemon jasmine && pnpm i",
|
|
17
17
|
"start": "npm run prep && nodemon",
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
"deploy": "npm run build",
|
|
20
20
|
"clean-deploy": "pnpm run clean && pnpm run build-all",
|
|
21
21
|
|
|
@@ -25,17 +25,24 @@
|
|
|
25
25
|
"build-base": "rimraf ./build && npx tsc",
|
|
26
26
|
"build-clean": "pnpm run clean && pnpm run build-base",
|
|
27
27
|
"build-n-test": "pnpm i && pnpm run build-tgz",
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
"clean": "pnpm run prep && rimraf ./build && rimraf package-lock.json && rimraf pnpm-lock.yaml && rimraf ./node_modules",
|
|
30
|
-
|
|
31
|
-
"test": "pnpm run build-base && jasmine",
|
|
30
|
+
|
|
31
|
+
"test": "npm run prep && pnpm run build-base && jasmine",
|
|
32
32
|
"test-clean": "pnpm run build-clean && jasmine",
|
|
33
33
|
"test-full": "pnpm run prep && pnpm run test",
|
|
34
|
-
|
|
34
|
+
"test-lint": "npm test && npm run lint",
|
|
35
|
+
"test-fix": "npm test && npm run lint:fix",
|
|
36
|
+
|
|
35
37
|
"nodemon-run": "npm run build-tgz",
|
|
36
|
-
|
|
37
38
|
"lint": "eslint src --ext .ts",
|
|
38
|
-
"lint:fix": "eslint src --ext .ts --fix"
|
|
39
|
+
"lint:fix": "eslint src --ext .ts --fix --fix-type problem,suggestion,layout",
|
|
40
|
+
"lint:fix-all": "eslint src --ext .ts --fix && dynamo-fix-return-types",
|
|
41
|
+
"validate:imports": "dynamo-validate-imports",
|
|
42
|
+
"validate:naming": "dynamo-validate-naming",
|
|
43
|
+
"audit:eslintrc": "dynamo-eslintrc-audit",
|
|
44
|
+
"fix": "dynamo-fix",
|
|
45
|
+
"fix:return-types": "dynamo-fix-return-types"
|
|
39
46
|
},
|
|
40
47
|
"exports": {
|
|
41
48
|
".": {
|
|
@@ -53,7 +60,9 @@
|
|
|
53
60
|
"bin": {
|
|
54
61
|
"dynamo-validate-imports": "./build/scripts/validate-imports.js",
|
|
55
62
|
"dynamo-validate-naming": "./build/scripts/validate-naming.js",
|
|
56
|
-
"dynamo-eslintrc-audit": "./build/scripts/eslintrc-audit.js"
|
|
63
|
+
"dynamo-eslintrc-audit": "./build/scripts/eslintrc-audit.js",
|
|
64
|
+
"dynamo-fix": "./build/scripts/dynamo-fix.js",
|
|
65
|
+
"dynamo-fix-return-types": "./build/scripts/fix-return-types.js"
|
|
57
66
|
},
|
|
58
67
|
"keywords": [
|
|
59
68
|
"eslint",
|
|
@@ -63,33 +72,33 @@
|
|
|
63
72
|
"dynamo"
|
|
64
73
|
],
|
|
65
74
|
"peerDependencies": {
|
|
66
|
-
"eslint": "^
|
|
75
|
+
"@angular-eslint/eslint-plugin": "^19.0.0",
|
|
76
|
+
"@angular-eslint/eslint-plugin-template": "^19.0.0",
|
|
77
|
+
"@angular-eslint/template-parser": "^19.0.0",
|
|
67
78
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
68
79
|
"@typescript-eslint/parser": "^8.0.0",
|
|
80
|
+
"eslint": "^9.0.0",
|
|
69
81
|
"eslint-plugin-import": "^2.29.0",
|
|
70
82
|
"eslint-plugin-jsdoc": "^48.0.0",
|
|
71
83
|
"eslint-plugin-prettier": "^5.1.3",
|
|
72
|
-
"prettier": "^3.3.0"
|
|
73
|
-
"@angular-eslint/eslint-plugin": "^19.0.0",
|
|
74
|
-
"@angular-eslint/eslint-plugin-template": "^19.0.0",
|
|
75
|
-
"@angular-eslint/template-parser": "^19.0.0"
|
|
84
|
+
"prettier": "^3.3.0"
|
|
76
85
|
},
|
|
77
86
|
"dependencies": {
|
|
78
|
-
"@futdevpro/fsm-dynamo": "1.
|
|
87
|
+
"@futdevpro/fsm-dynamo": "1.14.11",
|
|
79
88
|
"fast-glob": "^3.3.2",
|
|
80
89
|
"tslib": "~2.8.1"
|
|
81
90
|
},
|
|
82
91
|
"devDependencies": {
|
|
83
|
-
"@types/node": "~20.12.12",
|
|
84
92
|
"@types/jasmine": "~4.3.5",
|
|
93
|
+
"@types/node": "~20.12.12",
|
|
85
94
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
86
95
|
"@typescript-eslint/parser": "^8.0.0",
|
|
87
96
|
"eslint": "^9.0.0",
|
|
97
|
+
"eslint-plugin-max-params-no-constructor": "^0.0.4",
|
|
98
|
+
"eslint-plugin-unused-imports": "^4.2.0",
|
|
88
99
|
"jasmine": "5.10.0",
|
|
89
100
|
"jasmine-spec-reporter": "^7.0.0",
|
|
90
101
|
"rimraf": "^5.0.5",
|
|
91
102
|
"typescript": "~5.5.4"
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
|
-
|
|
95
|
-
|
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
// ❌ VIOLATIONS: This file contains multiple import ordering violations
|
|
5
5
|
|
|
6
6
|
// Wrong order: FutDevPro packages before non-FutDevPro packages
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
7
17
|
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
8
18
|
import { Component } from '@angular/core';
|
|
9
19
|
|
|
@@ -12,13 +22,32 @@ import { Router } from '@angular/router';
|
|
|
12
22
|
import { FDP_User } from '@futdevpro/fdp-templates';
|
|
13
23
|
|
|
14
24
|
// Wrong order: same module before other modules
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
15
35
|
import { LocalService } from './local.service';
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
16
45
|
import { SomeService } from '../../../services/some.service';
|
|
17
46
|
|
|
18
47
|
// ❌ Forbidden patterns:
|
|
19
|
-
import { Something } from '
|
|
20
|
-
import { AnotherThing } from './some-file
|
|
21
|
-
import
|
|
48
|
+
import { Something } from '@futdevpro/some-package'; // Forbidden NPM-packages import
|
|
49
|
+
import { AnotherThing } from './some-file'; // Forbidden .js extension
|
|
50
|
+
import { SomeType } from './some-file'; // Forbidden import type
|
|
22
51
|
|
|
23
52
|
export class PocViolationsComponent {
|
|
24
53
|
// This class demonstrates various import violations
|
package/src/configs/base.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Base Rulesets For Dynamo Based Systems
|
|
4
|
+
*/
|
|
1
5
|
export = {
|
|
2
6
|
env: { browser: true, es2021: true },
|
|
3
7
|
parser: '@typescript-eslint/parser',
|
|
@@ -6,6 +10,7 @@ export = {
|
|
|
6
10
|
'@typescript-eslint',
|
|
7
11
|
'unused-imports',
|
|
8
12
|
'max-params-no-constructor',
|
|
13
|
+
'@futdevpro/dynamo',
|
|
9
14
|
],
|
|
10
15
|
extends: [
|
|
11
16
|
'eslint:recommended',
|
|
@@ -13,11 +18,11 @@ export = {
|
|
|
13
18
|
],
|
|
14
19
|
rules: {
|
|
15
20
|
'no-warning-comments': ['warn', { terms: ['todo', 'fixme', 'removable', '??'], location: 'anywhere' }],
|
|
16
|
-
indent: ['warn', 2, { SwitchCase: 1 }],
|
|
21
|
+
'indent': ['warn', 2, { SwitchCase: 1 }],
|
|
17
22
|
'max-len': ['warn', { code: 100, comments: 120 }],
|
|
18
23
|
'max-lines': ['warn', 1000],
|
|
19
24
|
'linebreak-style': 'off',
|
|
20
|
-
semi: ['warn', 'always'],
|
|
25
|
+
'semi': ['warn', 'always'],
|
|
21
26
|
'no-unused-vars': 'off',
|
|
22
27
|
'no-prototype-builtins': 'off',
|
|
23
28
|
'no-empty': 'warn',
|
|
@@ -39,12 +44,17 @@ export = {
|
|
|
39
44
|
'no-duplicate-imports': 'warn',
|
|
40
45
|
'max-params': ['warn', 4],
|
|
41
46
|
'max-params-no-constructor/max-params-no-constructor': ['warn', 5],
|
|
42
|
-
quotes: ['warn', 'single', { allowTemplateLiterals: true }],
|
|
43
|
-
'@typescript-eslint/quotes': ['warn', 'single', { allowTemplateLiterals: true }],
|
|
47
|
+
'quotes': ['warn', 'single', { allowTemplateLiterals: true }],
|
|
44
48
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
45
49
|
'@typescript-eslint/explicit-function-return-type': ['warn', { allowTypedFunctionExpressions: false }],
|
|
46
50
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
47
51
|
'@typescript-eslint/typedef': 'warn',
|
|
52
|
+
|
|
53
|
+
// Dynamo custom rules
|
|
54
|
+
'@futdevpro/dynamo/import-order': 'warn',
|
|
55
|
+
'@futdevpro/dynamo/naming-patterns': 'warn',
|
|
56
|
+
'@futdevpro/dynamo/no-import-type': 'warn',
|
|
57
|
+
'@futdevpro/dynamo/no-js-import': 'warn',
|
|
48
58
|
},
|
|
49
59
|
};
|
|
50
60
|
|
package/src/configs/fsm.ts
CHANGED
package/src/configs/ngx.ts
CHANGED
package/src/configs/nts.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import base = require('./base');
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Rulesets For Dynamo Based Systems
|
|
5
|
+
* NTS: Node TypeScript
|
|
6
|
+
*/
|
|
3
7
|
const config = {
|
|
4
8
|
...base,
|
|
5
9
|
env: { node: true, es2021: true },
|
|
6
10
|
parserOptions: { ...base.parserOptions, sourceType: 'module' },
|
|
7
11
|
rules: {
|
|
8
12
|
...base.rules,
|
|
9
|
-
'max-lines': ['warn', 1500],
|
|
13
|
+
'max-lines': [ 'warn', 1500 ],
|
|
10
14
|
},
|
|
11
15
|
};
|
|
12
16
|
|
package/src/plugin/index.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import importOrderRule from './rules/import-order';
|
|
1
|
+
import importOrderRule from './rules/import/import-order';
|
|
2
2
|
import namingPatternsRule from './rules/naming-patterns';
|
|
3
|
+
import noImportTypeRule from './rules/import/no-import-type';
|
|
4
|
+
import noJsExtensionRule from './rules/import/no-js-import';
|
|
3
5
|
|
|
4
6
|
export = {
|
|
5
7
|
rules: {
|
|
6
8
|
'import-order': importOrderRule,
|
|
9
|
+
'no-import-type': noImportTypeRule,
|
|
10
|
+
'no-js-import': noJsExtensionRule,
|
|
11
|
+
|
|
7
12
|
'naming-patterns': namingPatternsRule,
|
|
8
13
|
},
|
|
9
14
|
configs: {
|
|
10
15
|
recommended: {
|
|
11
16
|
rules: {
|
|
12
17
|
'@futdevpro/dynamo/import-order': 'warn',
|
|
18
|
+
'@futdevpro/dynamo/no-import-type': 'warn',
|
|
19
|
+
'@futdevpro/dynamo/no-js-import': 'warn',
|
|
20
|
+
|
|
13
21
|
'@futdevpro/dynamo/naming-patterns': 'warn',
|
|
14
22
|
},
|
|
15
23
|
},
|