@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.
Files changed (47) hide show
  1. package/README.md +264 -29
  2. package/build/configs/base.d.ts +6 -81
  3. package/build/configs/base.d.ts.map +1 -1
  4. package/build/configs/base.js +89 -54
  5. package/build/configs/base.js.map +1 -1
  6. package/build/configs/fsm.d.ts +1 -85
  7. package/build/configs/fsm.d.ts.map +1 -1
  8. package/build/configs/fsm.js +3 -6
  9. package/build/configs/fsm.js.map +1 -1
  10. package/build/configs/ngx-package.d.ts +1 -85
  11. package/build/configs/ngx-package.d.ts.map +1 -1
  12. package/build/configs/ngx-package.js +3 -6
  13. package/build/configs/ngx-package.js.map +1 -1
  14. package/build/configs/ngx.d.ts +4 -85
  15. package/build/configs/ngx.d.ts.map +1 -1
  16. package/build/configs/ngx.js +67 -11
  17. package/build/configs/ngx.js.map +1 -1
  18. package/build/configs/nts-package.d.ts +1 -87
  19. package/build/configs/nts-package.d.ts.map +1 -1
  20. package/build/configs/nts-package.js +12 -10
  21. package/build/configs/nts-package.js.map +1 -1
  22. package/build/configs/nts.d.ts +1 -86
  23. package/build/configs/nts.d.ts.map +1 -1
  24. package/build/configs/nts.js +26 -11
  25. package/build/configs/nts.js.map +1 -1
  26. package/build/scripts/fix-return-types.js.map +1 -1
  27. package/futdevpro-dynamo-eslint-01.14.3.tgz +0 -0
  28. package/package.json +1 -1
  29. package/samples/.vscode/settings.json +13 -0
  30. package/samples/base/eslint.config.js +3 -0
  31. package/samples/fsm/.eslintrc.json +4 -0
  32. package/samples/fsm/eslint.config.js +3 -0
  33. package/samples/ngx/eslint.config.js +3 -0
  34. package/samples/ngx-package/.eslintrc.json +4 -0
  35. package/samples/ngx-package/eslint.config.js +3 -0
  36. package/samples/nts/eslint.config.js +3 -0
  37. package/samples/nts-package/.eslintrc.json +4 -0
  38. package/samples/nts-package/eslint.config.js +3 -0
  39. package/samples/package.json.example +26 -0
  40. package/src/configs/base.ts +89 -54
  41. package/src/configs/fsm.ts +3 -6
  42. package/src/configs/ngx-package.ts +3 -6
  43. package/src/configs/ngx.ts +67 -11
  44. package/src/configs/nts-package.ts +12 -10
  45. package/src/configs/nts.ts +26 -11
  46. package/src/scripts/fix-return-types.ts +2 -0
  47. package/futdevpro-dynamo-eslint-01.14.2.tgz +0 -0
@@ -0,0 +1,3 @@
1
+ const fsmConfig = require('@futdevpro/dynamo-eslint/fsm');
2
+
3
+ module.exports = fsmConfig;
@@ -0,0 +1,3 @@
1
+ const ngxConfig = require('@futdevpro/dynamo-eslint/ngx');
2
+
3
+ module.exports = ngxConfig;
@@ -0,0 +1,4 @@
1
+ {
2
+ "root": true,
3
+ "extends": ["@futdevpro/dynamo-eslint/ngx-package"]
4
+ }
@@ -0,0 +1,3 @@
1
+ const ngxPackageConfig = require('@futdevpro/dynamo-eslint/ngx-package');
2
+
3
+ module.exports = ngxPackageConfig;
@@ -0,0 +1,3 @@
1
+ const ntsConfig = require('@futdevpro/dynamo-eslint/nts');
2
+
3
+ module.exports = ntsConfig;
@@ -0,0 +1,4 @@
1
+ {
2
+ "root": true,
3
+ "extends": ["@futdevpro/dynamo-eslint/nts-package"]
4
+ }
@@ -0,0 +1,3 @@
1
+ const ntsPackageConfig = require('@futdevpro/dynamo-eslint/nts-package');
2
+
3
+ module.exports = ntsPackageConfig;
@@ -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
+ }
@@ -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
- export = {
6
- env: { browser: true, es2021: true },
7
- parser: '@typescript-eslint/parser',
8
- parserOptions: { ecmaVersion: 'latest' },
9
- plugins: [
10
- '@typescript-eslint',
11
- 'unused-imports',
12
- 'max-params-no-constructor',
13
- '@futdevpro/dynamo',
14
- ],
15
- extends: [
16
- 'eslint:recommended',
17
- 'plugin:@typescript-eslint/recommended',
18
- ],
19
- rules: {
20
- 'no-warning-comments': ['warn', { terms: ['todo', 'fixme', 'removable', '??'], location: 'anywhere' }],
21
- 'indent': ['warn', 2, { SwitchCase: 1 }],
22
- 'max-len': ['warn', { code: 100, comments: 120 }],
23
- 'max-lines': ['warn', 1000],
24
- 'linebreak-style': 'off',
25
- 'semi': ['warn', 'always'],
26
- 'no-unused-vars': 'off',
27
- 'no-prototype-builtins': 'off',
28
- 'no-empty': 'warn',
29
- 'comma-dangle': ['warn', { arrays: 'always-multiline', objects: 'always-multiline', functions: 'only-multiline', imports: 'never', exports: 'never' }],
30
- 'brace-style': ['warn', '1tbs', { allowSingleLine: false }],
31
- 'object-curly-spacing': ['warn', 'always'],
32
- 'array-bracket-spacing': ['warn', 'always', { objectsInArrays: false, arraysInArrays: false }],
33
- 'padding-line-between-statements': [
34
- 'warn',
35
- { blankLine: 'always', prev: '*', next: ['return','throw','if','for','while','switch','default'] },
36
- { blankLine: 'always', prev: ['const','let','var','break'], next: '*' },
37
- { blankLine: 'any', prev: ['const','let','var'], next: ['const','let','var'] },
38
- ],
39
- 'prefer-const': 'warn',
40
- 'no-case-declarations': 'off',
41
- 'no-fallthrough': 'off',
42
- 'keyword-spacing': 'warn',
43
- 'no-else-return': 'warn',
44
- 'no-duplicate-imports': 'warn',
45
- 'max-params': ['warn', 4],
46
- 'max-params-no-constructor/max-params-no-constructor': ['warn', 5],
47
- 'quotes': ['warn', 'single', { allowTemplateLiterals: true }],
48
- '@typescript-eslint/no-unused-vars': 'warn',
49
- '@typescript-eslint/explicit-function-return-type': ['warn', { allowTypedFunctionExpressions: false }],
50
- '@typescript-eslint/no-explicit-any': 'warn',
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',
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
 
@@ -1,13 +1,10 @@
1
- import base = require('./base');
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
- const config = {
8
- ...base,
9
- };
10
-
11
- export = config;
8
+ module.exports = fsmBaseConfig;
12
9
 
13
10
 
@@ -1,13 +1,10 @@
1
- import ngx = require('./ngx');
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
- const config = {
8
- ...ngx,
9
- };
10
-
11
- export = config;
8
+ module.exports = ngxConfig;
12
9
 
13
10
 
@@ -1,18 +1,74 @@
1
- import base = require('./base');
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
- const config = {
8
- ...base,
9
- env: { browser: true, es2021: true },
10
- extends: [
11
- ...base.extends,
12
- 'plugin:@angular-eslint/recommended',
13
- ],
14
- };
15
-
16
- export = config;
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
- import nts = require('./nts');
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
- const config = {
8
- ...nts,
9
- rules: {
10
- ...nts.rules,
11
- '@typescript-eslint/ban-types': 'off',
12
- '@typescript-eslint/no-explicit-any': 'off',
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
 
@@ -1,19 +1,34 @@
1
- import base = require('./base');
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
- const config = {
8
- ...base,
9
- env: { node: true, es2021: true },
10
- parserOptions: { ...base.parserOptions, sourceType: 'module' },
11
- rules: {
12
- ...base.rules,
13
- 'max-lines': [ 'warn', 1500 ],
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