@futdevpro/dynamo-eslint 1.14.2 → 1.14.3
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/README.md +264 -29
- package/build/configs/base.d.ts +6 -81
- package/build/configs/base.d.ts.map +1 -1
- package/build/configs/base.js +89 -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/scripts/fix-return-types.js.map +1 -1
- package/futdevpro-dynamo-eslint-01.14.3.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 +89 -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/scripts/fix-return-types.ts +2 -0
- package/futdevpro-dynamo-eslint-01.14.2.tgz +0 -0
|
@@ -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,96 @@
|
|
|
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: 100, 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/import-order': 'warn',
|
|
89
|
+
'@futdevpro/dynamo/naming-patterns': 'warn',
|
|
90
|
+
'@futdevpro/dynamo/no-import-type': 'warn',
|
|
91
|
+
'@futdevpro/dynamo/no-js-import': 'warn',
|
|
92
|
+
},
|
|
58
93
|
},
|
|
59
|
-
|
|
94
|
+
];
|
|
60
95
|
|
|
61
96
|
|
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
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
const ntsConfig = require('./nts');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Rulesets For Dynamo Based Systems
|
|
5
5
|
* NTS-PACKAGE: Node TypeScript Package
|
|
6
|
+
* ESLint v9 Flat Config Format
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
...
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
module.exports = [
|
|
9
|
+
...ntsConfig,
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
12
|
+
rules: {
|
|
13
|
+
...ntsConfig[1].rules,
|
|
14
|
+
'@typescript-eslint/ban-types': 'off',
|
|
15
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
16
|
+
},
|
|
13
17
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export = config;
|
|
18
|
+
];
|
|
17
19
|
|
|
18
20
|
|
package/src/configs/nts.ts
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
const ntsBaseConfig = require('./base');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Rulesets For Dynamo Based Systems
|
|
5
5
|
* NTS: Node TypeScript
|
|
6
|
+
* ESLint v9 Flat Config Format
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
...
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
module.exports = [
|
|
9
|
+
...ntsBaseConfig,
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
...ntsBaseConfig[1].languageOptions,
|
|
14
|
+
globals: {
|
|
15
|
+
// Node.js globals
|
|
16
|
+
process: 'readonly',
|
|
17
|
+
Buffer: 'readonly',
|
|
18
|
+
global: 'readonly',
|
|
19
|
+
__dirname: 'readonly',
|
|
20
|
+
__filename: 'readonly',
|
|
21
|
+
module: 'readonly',
|
|
22
|
+
require: 'readonly',
|
|
23
|
+
exports: 'readonly',
|
|
24
|
+
console: 'readonly'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
...ntsBaseConfig[1].rules,
|
|
29
|
+
'max-lines': ['warn', 1500],
|
|
30
|
+
},
|
|
14
31
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export = config;
|
|
32
|
+
];
|
|
18
33
|
|
|
19
34
|
|
|
@@ -30,6 +30,7 @@ function addReturnTypesToFile(filePath: string): FixResult {
|
|
|
30
30
|
// Handle function declarations
|
|
31
31
|
if (ts.isFunctionDeclaration(node) && !node.type) {
|
|
32
32
|
const signature = checker.getSignatureFromDeclaration(node);
|
|
33
|
+
|
|
33
34
|
if (signature) {
|
|
34
35
|
const returnType = checker.getReturnTypeOfSignature(signature);
|
|
35
36
|
const typeString = checker.typeToString(returnType);
|
|
@@ -56,6 +57,7 @@ function addReturnTypesToFile(filePath: string): FixResult {
|
|
|
56
57
|
// Handle arrow functions
|
|
57
58
|
if (ts.isArrowFunction(node) && !node.type) {
|
|
58
59
|
const signature = checker.getSignatureFromDeclaration(node);
|
|
60
|
+
|
|
59
61
|
if (signature) {
|
|
60
62
|
const returnType = checker.getReturnTypeOfSignature(signature);
|
|
61
63
|
const typeString = checker.typeToString(returnType);
|
|
Binary file
|