@futdevpro/dynamo-eslint 1.14.2 → 1.14.4
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/.eslintrc.json +4 -0
- package/.vscode/settings.json +13 -0
- package/README.md +279 -29
- package/build/configs/base.d.ts +6 -81
- package/build/configs/base.d.ts.map +1 -1
- package/build/configs/base.js +90 -54
- package/build/configs/base.js.map +1 -1
- package/build/configs/fsm.d.ts +1 -85
- package/build/configs/fsm.d.ts.map +1 -1
- package/build/configs/fsm.js +3 -6
- package/build/configs/fsm.js.map +1 -1
- package/build/configs/ngx-package.d.ts +1 -85
- package/build/configs/ngx-package.d.ts.map +1 -1
- package/build/configs/ngx-package.js +3 -6
- package/build/configs/ngx-package.js.map +1 -1
- package/build/configs/ngx.d.ts +4 -85
- package/build/configs/ngx.d.ts.map +1 -1
- package/build/configs/ngx.js +67 -11
- package/build/configs/ngx.js.map +1 -1
- package/build/configs/nts-package.d.ts +1 -87
- package/build/configs/nts-package.d.ts.map +1 -1
- package/build/configs/nts-package.js +12 -10
- package/build/configs/nts-package.js.map +1 -1
- package/build/configs/nts.d.ts +1 -86
- package/build/configs/nts.d.ts.map +1 -1
- package/build/configs/nts.js +26 -11
- package/build/configs/nts.js.map +1 -1
- package/build/plugin/index.d.ts +2 -0
- package/build/plugin/index.d.ts.map +1 -1
- package/build/plugin/index.js +3 -0
- package/build/plugin/index.js.map +1 -1
- package/build/plugin/rules/explicit-types.d.ts +4 -0
- package/build/plugin/rules/explicit-types.d.ts.map +1 -0
- package/build/plugin/rules/explicit-types.js +165 -0
- package/build/plugin/rules/explicit-types.js.map +1 -0
- package/build/plugin/rules/explicit-types.spec.d.ts +2 -0
- package/build/plugin/rules/explicit-types.spec.d.ts.map +1 -0
- package/build/plugin/rules/explicit-types.spec.js +162 -0
- package/build/plugin/rules/explicit-types.spec.js.map +1 -0
- package/build/plugin/rules/import/no-import-type.d.ts.map +1 -1
- package/build/plugin/rules/import/no-import-type.js +23 -12
- package/build/plugin/rules/import/no-import-type.js.map +1 -1
- package/build/plugin/rules/import/no-js-import.d.ts.map +1 -1
- package/build/plugin/rules/import/no-js-import.js +22 -11
- package/build/plugin/rules/import/no-js-import.js.map +1 -1
- package/build/plugin/rules/naming-patterns.d.ts.map +1 -1
- package/build/plugin/rules/naming-patterns.js +7 -2
- package/build/plugin/rules/naming-patterns.js.map +1 -1
- package/build/scripts/dynamo-fix.d.ts +24 -0
- package/build/scripts/dynamo-fix.d.ts.map +1 -1
- package/build/scripts/dynamo-fix.js +57 -2
- package/build/scripts/dynamo-fix.js.map +1 -1
- package/build/scripts/eslintrc-audit.d.ts +24 -0
- package/build/scripts/eslintrc-audit.d.ts.map +1 -1
- package/build/scripts/eslintrc-audit.js +65 -0
- package/build/scripts/eslintrc-audit.js.map +1 -1
- package/build/scripts/fix-return-types.d.ts +25 -0
- package/build/scripts/fix-return-types.d.ts.map +1 -1
- package/build/scripts/fix-return-types.js +80 -9
- package/build/scripts/fix-return-types.js.map +1 -1
- package/build/scripts/validate-imports.d.ts +24 -0
- package/build/scripts/validate-imports.d.ts.map +1 -1
- package/build/scripts/validate-imports.js +62 -1
- package/build/scripts/validate-imports.js.map +1 -1
- package/build/scripts/validate-naming.d.ts +24 -0
- package/build/scripts/validate-naming.d.ts.map +1 -1
- package/build/scripts/validate-naming.js +72 -9
- package/build/scripts/validate-naming.js.map +1 -1
- package/eslint.config.js +9 -49
- package/futdevpro-dynamo-eslint-01.14.4.tgz +0 -0
- package/package.json +1 -1
- package/samples/.vscode/settings.json +13 -0
- package/samples/base/eslint.config.js +3 -0
- package/samples/fsm/.eslintrc.json +4 -0
- package/samples/fsm/eslint.config.js +3 -0
- package/samples/ngx/eslint.config.js +3 -0
- package/samples/ngx-package/.eslintrc.json +4 -0
- package/samples/ngx-package/eslint.config.js +3 -0
- package/samples/nts/eslint.config.js +3 -0
- package/samples/nts-package/.eslintrc.json +4 -0
- package/samples/nts-package/eslint.config.js +3 -0
- package/samples/package.json.example +26 -0
- package/src/configs/base.ts +90 -54
- package/src/configs/fsm.ts +3 -6
- package/src/configs/ngx-package.ts +3 -6
- package/src/configs/ngx.ts +67 -11
- package/src/configs/nts-package.ts +12 -10
- package/src/configs/nts.ts +26 -11
- package/src/plugin/index.ts +3 -0
- package/src/plugin/rules/explicit-types.spec.ts +190 -0
- package/src/plugin/rules/explicit-types.ts +169 -0
- package/src/plugin/rules/import/no-import-type.ts +21 -12
- package/src/plugin/rules/import/no-js-import.ts +21 -13
- package/src/plugin/rules/naming-patterns.ts +6 -2
- package/src/scripts/dynamo-fix.ts +66 -2
- package/src/scripts/eslintrc-audit.ts +73 -2
- package/src/scripts/fix-return-types.ts +93 -9
- package/src/scripts/validate-imports.ts +71 -2
- package/src/scripts/validate-naming.ts +108 -17
- package/futdevpro-dynamo-eslint-01.14.2.tgz +0 -0
|
@@ -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":";;AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAkFH,sDAAiD;AACjD,kEAA2B;AAC3B,mCAAgC;AAqBhC;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,UAAU,qBAAqB,CAAC,QAAgB;IACnD,iDAAiD;IACjD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC;QACxB,UAAU,EAAE;YACV,MAAM,EAAE,2BAA2B;YACnC,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;aACrB;YACD,KAAK,EAAE;gBACL,gCAAgC,EAAE,OAAO;aAC1C;YACD,OAAO,EAAE;gBACP,mBAAmB,EAAE;oBACnB,KAAK,EAAE;wBACL,cAAc,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC,OAAO;qBAChE;i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@fileoverview Naming Convention Validation Script
|
|
4
|
+
*
|
|
5
|
+
* This script validates naming conventions across all TypeScript files in the project
|
|
6
|
+
* using the Dynamo naming-patterns ESLint rule. It scans files, runs ESLint validation,
|
|
7
|
+
* and reports any naming convention violations.
|
|
8
|
+
*
|
|
9
|
+
* @usage
|
|
10
|
+
* ```bash
|
|
11
|
+
* dynamo-validate-naming
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```bash
|
|
16
|
+
* # Validate naming conventions in all TypeScript files
|
|
17
|
+
* npx dynamo-validate-naming
|
|
18
|
+
*
|
|
19
|
+
* # Or run via npm script
|
|
20
|
+
* npm run validate:naming
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @author Future Development Program Ltd.
|
|
24
|
+
* @version 1.14.3
|
|
25
|
+
*/
|
|
2
26
|
export {};
|
|
3
27
|
//# sourceMappingURL=validate-naming.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-naming.d.ts","sourceRoot":"","sources":["../../src/scripts/validate-naming.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"validate-naming.d.ts","sourceRoot":"","sources":["../../src/scripts/validate-naming.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|
|
@@ -1,19 +1,64 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Naming Convention Validation Script
|
|
5
|
+
*
|
|
6
|
+
* This script validates naming conventions across all TypeScript files in the project
|
|
7
|
+
* using the Dynamo naming-patterns ESLint rule. It scans files, runs ESLint validation,
|
|
8
|
+
* and reports any naming convention violations.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* ```bash
|
|
12
|
+
* dynamo-validate-naming
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```bash
|
|
17
|
+
* # Validate naming conventions in all TypeScript files
|
|
18
|
+
* npx dynamo-validate-naming
|
|
19
|
+
*
|
|
20
|
+
* # Or run via npm script
|
|
21
|
+
* npm run validate:naming
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @author Future Development Program Ltd.
|
|
25
|
+
* @version 1.14.3
|
|
26
|
+
*/
|
|
3
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
28
|
const tslib_1 = require("tslib");
|
|
5
29
|
const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
|
|
6
30
|
const eslint_1 = require("eslint");
|
|
7
31
|
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
32
|
+
/**
|
|
33
|
+
* Validates naming conventions in a single TypeScript file
|
|
34
|
+
*
|
|
35
|
+
* Uses ESLint with the Dynamo naming-patterns rule to check for naming convention
|
|
36
|
+
* violations and returns detailed error information.
|
|
37
|
+
*
|
|
38
|
+
* @param filePath - Path to the TypeScript file to validate
|
|
39
|
+
* @returns Promise that resolves to a NamingValidationResult object
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const result = await validateNamingInFile('./src/components/Button.tsx');
|
|
44
|
+
* if (result.errors.length > 0) {
|
|
45
|
+
* console.log(`Found ${result.errors.length} naming violations`);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
8
49
|
async function validateNamingInFile(filePath) {
|
|
50
|
+
// Configure ESLint using the main Dynamo configuration
|
|
9
51
|
const eslint = new eslint_1.ESLint({
|
|
10
|
-
|
|
52
|
+
// Use the main config object from flat config array
|
|
53
|
+
baseConfig: require('../eslint.config.js')[1],
|
|
11
54
|
});
|
|
55
|
+
// Run ESLint on the file
|
|
12
56
|
const results = await eslint.lintFiles([filePath]);
|
|
13
57
|
const result = results[0];
|
|
58
|
+
// Transform ESLint messages into our result format
|
|
14
59
|
return {
|
|
15
60
|
file: filePath,
|
|
16
|
-
errors: result.messages.map(msg => ({
|
|
61
|
+
errors: result.messages.map((msg) => ({
|
|
17
62
|
line: msg.line,
|
|
18
63
|
column: msg.column,
|
|
19
64
|
message: msg.message,
|
|
@@ -21,39 +66,57 @@ async function validateNamingInFile(filePath) {
|
|
|
21
66
|
})),
|
|
22
67
|
};
|
|
23
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Main function that validates naming conventions across all TypeScript files
|
|
71
|
+
*
|
|
72
|
+
* Scans for all .ts and .tsx files in the project, validates naming conventions
|
|
73
|
+
* using the Dynamo naming-patterns rule, and provides detailed reporting on any
|
|
74
|
+
* violations found.
|
|
75
|
+
*
|
|
76
|
+
* @returns Promise that resolves when all files have been validated
|
|
77
|
+
*
|
|
78
|
+
* @throws {Error} When validation fails and process exits with code 1
|
|
79
|
+
*/
|
|
24
80
|
async function main() {
|
|
81
|
+
// Find all TypeScript files, excluding common directories and test files
|
|
25
82
|
const files = await (0, fast_glob_1.default)(['**/*.{ts,tsx}'], {
|
|
26
83
|
ignore: ['**/node_modules/**', '**/build/**', '**/dist/**', '**/*.spec.ts', '**/*.test.ts'],
|
|
27
84
|
});
|
|
28
85
|
fsm_dynamo_1.DyFM_Log.log(`[dynamo-validate-naming] Scanning ${files.length} files...`);
|
|
29
86
|
const results = [];
|
|
30
87
|
let totalErrors = 0;
|
|
31
|
-
|
|
88
|
+
// Process each file individually
|
|
89
|
+
for (let i = 0; i < files.length; i++) {
|
|
90
|
+
const filePath = files[i];
|
|
32
91
|
try {
|
|
33
|
-
const result = await validateNamingInFile(
|
|
92
|
+
const result = await validateNamingInFile(filePath);
|
|
34
93
|
results.push(result);
|
|
35
94
|
totalErrors += result.errors.length;
|
|
36
95
|
}
|
|
37
96
|
catch (error) {
|
|
38
|
-
fsm_dynamo_1.DyFM_Log.error(`Error processing ${
|
|
97
|
+
fsm_dynamo_1.DyFM_Log.error(`Error processing ${filePath}:`, error);
|
|
39
98
|
}
|
|
40
99
|
}
|
|
41
|
-
//
|
|
42
|
-
const filesWithErrors = results.filter(r => r.errors.length > 0);
|
|
100
|
+
// Filter files that have naming violations
|
|
101
|
+
const filesWithErrors = results.filter((r) => r.errors.length > 0);
|
|
102
|
+
// Report success if no violations found
|
|
43
103
|
if (filesWithErrors.length === 0) {
|
|
44
104
|
fsm_dynamo_1.DyFM_Log.log('✅ All naming validations passed!');
|
|
45
105
|
return;
|
|
46
106
|
}
|
|
107
|
+
// Report detailed error information
|
|
47
108
|
fsm_dynamo_1.DyFM_Log.warn(`\n❌ Found ${totalErrors} naming validation errors in ${filesWithErrors.length} files:\n`);
|
|
48
|
-
filesWithErrors.forEach(result => {
|
|
109
|
+
filesWithErrors.forEach((result) => {
|
|
49
110
|
fsm_dynamo_1.DyFM_Log.log(`📁 ${result.file}:`);
|
|
50
|
-
result.errors.forEach(error => {
|
|
111
|
+
result.errors.forEach((error) => {
|
|
51
112
|
fsm_dynamo_1.DyFM_Log.log(` ${error.line}:${error.column} - ${error.message}`);
|
|
52
113
|
});
|
|
53
114
|
fsm_dynamo_1.DyFM_Log.log('');
|
|
54
115
|
});
|
|
116
|
+
// Exit with error code to indicate validation failure
|
|
55
117
|
process.exit(1);
|
|
56
118
|
}
|
|
119
|
+
// Execute the main function and handle any errors
|
|
57
120
|
main().catch((err) => {
|
|
58
121
|
fsm_dynamo_1.DyFM_Log.error('Validation failed:', err);
|
|
59
122
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-naming.js","sourceRoot":"","sources":["../../src/scripts/validate-naming.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-naming.js","sourceRoot":"","sources":["../../src/scripts/validate-naming.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,kEAA2B;AAC3B,mCAAgC;AAEhC,sDAAiD;AAqBjD;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,UAAU,oBAAoB,CAAC,QAAgB;IAClD,uDAAuD;IACvD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C,CAAC,GAAU,EAAQ,EAAE;IAChC,qBAAQ,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/eslint.config.js
CHANGED
|
@@ -1,55 +1,15 @@
|
|
|
1
|
-
// ESLint v9 flat config for self-linting 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
1
|
const ntsPackageConfig = require('./build/configs/nts-package');
|
|
22
2
|
|
|
23
3
|
module.exports = [
|
|
24
|
-
|
|
25
|
-
ignores: [
|
|
26
|
-
'build/**',
|
|
27
|
-
'dist/**',
|
|
28
|
-
'node_modules/**'
|
|
29
|
-
]
|
|
30
|
-
},
|
|
4
|
+
...ntsPackageConfig,
|
|
31
5
|
{
|
|
32
|
-
files: [
|
|
33
|
-
'src/**/*.ts'
|
|
34
|
-
],
|
|
6
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
35
7
|
languageOptions: {
|
|
36
|
-
parser:
|
|
37
|
-
parserOptions: {
|
|
38
|
-
ecmaVersion: 'latest',
|
|
39
|
-
sourceType: 'module'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
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
|
-
},
|
|
8
|
+
parser: require('@typescript-eslint/parser'),
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaVersion: 'latest',
|
|
11
|
+
sourceType: 'module'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
53
15
|
];
|
|
54
|
-
|
|
55
|
-
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"eslint.run": "onSave",
|
|
3
|
+
"eslint.workingDirectories": [{ "mode": "auto" }],
|
|
4
|
+
"editor.codeActionsOnSave": {
|
|
5
|
+
"source.fixAll.eslint": "explicit"
|
|
6
|
+
},
|
|
7
|
+
"eslint.validate": [
|
|
8
|
+
"javascript",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"editor.formatOnSave": false,
|
|
12
|
+
"prettier.requireConfig": true
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-project",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"lint": "eslint src --ext .ts",
|
|
6
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
7
|
+
"lint:fix-all": "eslint src --ext .ts --fix && dynamo-fix-return-types",
|
|
8
|
+
"validate:imports": "dynamo-validate-imports",
|
|
9
|
+
"validate:naming": "dynamo-validate-naming",
|
|
10
|
+
"audit:eslintrc": "dynamo-eslintrc-audit",
|
|
11
|
+
"fix": "dynamo-fix",
|
|
12
|
+
"fix:return-types": "dynamo-fix-return-types",
|
|
13
|
+
"test": "npm run lint && npm run validate:imports && npm run validate:naming"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@futdevpro/dynamo-eslint": "^01.14.2",
|
|
17
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
18
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
19
|
+
"eslint": "^9.0.0",
|
|
20
|
+
"eslint-plugin-import": "^2.29.0",
|
|
21
|
+
"eslint-plugin-jsdoc": "^48.0.0",
|
|
22
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
23
|
+
"prettier": "^3.3.0",
|
|
24
|
+
"typescript": "^5.5.4"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/configs/base.ts
CHANGED
|
@@ -1,61 +1,97 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* Base Rulesets For Dynamo Based Systems
|
|
4
|
+
* ESLint v9 Flat Config Format
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
6
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
7
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
8
|
+
const unusedImportsPlugin = require('eslint-plugin-unused-imports');
|
|
9
|
+
const maxParamsNoConstructorPlugin = require('eslint-plugin-max-params-no-constructor');
|
|
10
|
+
const dynamoPlugin = require('../plugin');
|
|
11
|
+
|
|
12
|
+
module.exports = [
|
|
13
|
+
{
|
|
14
|
+
ignores: [
|
|
15
|
+
'node_modules/**',
|
|
16
|
+
'dist/**',
|
|
17
|
+
'build/**',
|
|
18
|
+
'*.d.ts'
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
23
|
+
languageOptions: {
|
|
24
|
+
parser: tsParser,
|
|
25
|
+
parserOptions: {
|
|
26
|
+
ecmaVersion: 'latest',
|
|
27
|
+
sourceType: 'module'
|
|
28
|
+
},
|
|
29
|
+
globals: {
|
|
30
|
+
// Browser globals
|
|
31
|
+
window: 'readonly',
|
|
32
|
+
document: 'readonly',
|
|
33
|
+
console: 'readonly',
|
|
34
|
+
process: 'readonly',
|
|
35
|
+
Buffer: 'readonly',
|
|
36
|
+
global: 'readonly',
|
|
37
|
+
__dirname: 'readonly',
|
|
38
|
+
__filename: 'readonly',
|
|
39
|
+
module: 'readonly',
|
|
40
|
+
require: 'readonly',
|
|
41
|
+
exports: 'readonly'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
plugins: {
|
|
45
|
+
'@typescript-eslint': tsPlugin,
|
|
46
|
+
'unused-imports': unusedImportsPlugin,
|
|
47
|
+
'max-params-no-constructor': maxParamsNoConstructorPlugin,
|
|
48
|
+
'@futdevpro/dynamo': dynamoPlugin,
|
|
49
|
+
},
|
|
50
|
+
rules: {
|
|
51
|
+
// ESLint recommended rules
|
|
52
|
+
'no-warning-comments': ['warn', { terms: ['todo', 'fixme', 'removable', '??'], location: 'anywhere' }],
|
|
53
|
+
'indent': ['warn', 2, { SwitchCase: 1 }],
|
|
54
|
+
'max-len': ['warn', { code: 120, comments: 120 }],
|
|
55
|
+
'max-lines': ['warn', 1000],
|
|
56
|
+
'linebreak-style': 'off',
|
|
57
|
+
'semi': ['warn', 'always'],
|
|
58
|
+
'no-unused-vars': 'off',
|
|
59
|
+
'no-prototype-builtins': 'off',
|
|
60
|
+
'no-empty': 'warn',
|
|
61
|
+
'comma-dangle': ['warn', { arrays: 'always-multiline', objects: 'always-multiline', functions: 'only-multiline', imports: 'never', exports: 'never' }],
|
|
62
|
+
'brace-style': ['warn', '1tbs', { allowSingleLine: false }],
|
|
63
|
+
'object-curly-spacing': ['warn', 'always'],
|
|
64
|
+
'array-bracket-spacing': ['warn', 'always', { objectsInArrays: false, arraysInArrays: false }],
|
|
65
|
+
'padding-line-between-statements': [
|
|
66
|
+
'warn',
|
|
67
|
+
{ blankLine: 'always', prev: '*', next: ['return','throw','if','for','while','switch','default'] },
|
|
68
|
+
{ blankLine: 'always', prev: ['const','let','var','break'], next: '*' },
|
|
69
|
+
{ blankLine: 'any', prev: ['const','let','var'], next: ['const','let','var'] },
|
|
70
|
+
],
|
|
71
|
+
'prefer-const': 'warn',
|
|
72
|
+
'no-case-declarations': 'off',
|
|
73
|
+
'no-fallthrough': 'off',
|
|
74
|
+
'keyword-spacing': 'warn',
|
|
75
|
+
'no-else-return': 'warn',
|
|
76
|
+
'no-duplicate-imports': 'warn',
|
|
77
|
+
'max-params': ['warn', 4],
|
|
78
|
+
'max-params-no-constructor/max-params-no-constructor': ['warn', 5],
|
|
79
|
+
'quotes': ['warn', 'single', { allowTemplateLiterals: true }],
|
|
80
|
+
|
|
81
|
+
// TypeScript rules
|
|
82
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
83
|
+
'@typescript-eslint/explicit-function-return-type': ['warn', { allowTypedFunctionExpressions: false }],
|
|
84
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
85
|
+
'@typescript-eslint/typedef': 'warn',
|
|
86
|
+
|
|
87
|
+
// Dynamo custom rules
|
|
88
|
+
'@futdevpro/dynamo/explicit-types': 'warn',
|
|
89
|
+
'@futdevpro/dynamo/import-order': 'warn',
|
|
90
|
+
'@futdevpro/dynamo/naming-patterns': 'warn',
|
|
91
|
+
'@futdevpro/dynamo/no-import-type': 'warn',
|
|
92
|
+
'@futdevpro/dynamo/no-js-import': 'warn',
|
|
93
|
+
},
|
|
58
94
|
},
|
|
59
|
-
|
|
95
|
+
];
|
|
60
96
|
|
|
61
97
|
|
package/src/configs/fsm.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const fsmBaseConfig = require('./base');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Rulesets For Dynamo Based Systems
|
|
5
5
|
* FSM: Full Stack Module
|
|
6
|
+
* ESLint v9 Flat Config Format
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
...base,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export = config;
|
|
8
|
+
module.exports = fsmBaseConfig;
|
|
12
9
|
|
|
13
10
|
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const ngxConfig = require('./ngx');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Rulesets For Dynamo Based Systems
|
|
5
5
|
* NGX-PACKAGE: Angular Package
|
|
6
|
+
* ESLint v9 Flat Config Format
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
...ngx,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export = config;
|
|
8
|
+
module.exports = ngxConfig;
|
|
12
9
|
|
|
13
10
|
|
package/src/configs/ngx.ts
CHANGED
|
@@ -1,18 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
const ngxBaseConfig = require('./base');
|
|
2
|
+
const angularPlugin = require('@angular-eslint/eslint-plugin');
|
|
3
|
+
const angularTemplatePlugin = require('@angular-eslint/eslint-plugin-template');
|
|
4
|
+
const angularTemplateParser = require('@angular-eslint/template-parser');
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Rulesets For Dynamo Based Systems
|
|
5
8
|
* NGX: Angular Projects
|
|
9
|
+
* ESLint v9 Flat Config Format
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
...
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
module.exports = [
|
|
12
|
+
...ngxBaseConfig,
|
|
13
|
+
{
|
|
14
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
15
|
+
languageOptions: {
|
|
16
|
+
...ngxBaseConfig[1].languageOptions,
|
|
17
|
+
globals: {
|
|
18
|
+
// Angular globals
|
|
19
|
+
window: 'readonly',
|
|
20
|
+
document: 'readonly',
|
|
21
|
+
console: 'readonly',
|
|
22
|
+
process: 'readonly',
|
|
23
|
+
Buffer: 'readonly',
|
|
24
|
+
global: 'readonly',
|
|
25
|
+
__dirname: 'readonly',
|
|
26
|
+
__filename: 'readonly',
|
|
27
|
+
module: 'readonly',
|
|
28
|
+
require: 'readonly',
|
|
29
|
+
exports: 'readonly'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
plugins: {
|
|
33
|
+
...ngxBaseConfig[1].plugins,
|
|
34
|
+
'@angular-eslint': angularPlugin,
|
|
35
|
+
},
|
|
36
|
+
rules: {
|
|
37
|
+
...ngxBaseConfig[1].rules,
|
|
38
|
+
// Angular-specific rules
|
|
39
|
+
'@angular-eslint/directive-selector': 'error',
|
|
40
|
+
'@angular-eslint/component-selector': 'error',
|
|
41
|
+
'@angular-eslint/no-conflicting-lifecycle': 'error',
|
|
42
|
+
'@angular-eslint/no-host-metadata-property': 'error',
|
|
43
|
+
'@angular-eslint/no-input-rename': 'error',
|
|
44
|
+
'@angular-eslint/no-output-rename': 'error',
|
|
45
|
+
'@angular-eslint/no-outputs-metadata-property': 'error',
|
|
46
|
+
'@angular-eslint/use-lifecycle-interface': 'error',
|
|
47
|
+
'@angular-eslint/use-pipe-transform-interface': 'error',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
files: ['**/*.html'],
|
|
52
|
+
languageOptions: {
|
|
53
|
+
parser: angularTemplateParser,
|
|
54
|
+
parserOptions: {
|
|
55
|
+
ecmaVersion: 'latest',
|
|
56
|
+
sourceType: 'module',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
plugins: {
|
|
60
|
+
'@angular-eslint/template': angularTemplatePlugin,
|
|
61
|
+
},
|
|
62
|
+
rules: {
|
|
63
|
+
'@angular-eslint/template/banana-in-box': 'error',
|
|
64
|
+
'@angular-eslint/template/cyclomatic-complexity': 'error',
|
|
65
|
+
'@angular-eslint/template/eqeqeq': 'error',
|
|
66
|
+
'@angular-eslint/template/no-call-expression': 'error',
|
|
67
|
+
'@angular-eslint/template/no-duplicate-attributes': 'error',
|
|
68
|
+
'@angular-eslint/template/no-negated-async': 'error',
|
|
69
|
+
'@angular-eslint/template/use-track-by-function': 'error',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
|
17
73
|
|
|
18
74
|
|