@aneuhold/eslint-config 1.0.55 → 1.0.57

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 (2) hide show
  1. package/package.json +13 -10
  2. package/src/angular-config.js +213 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aneuhold/eslint-config",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "Main ESLint Configuration for personal projects",
5
5
  "main": "./src/ts-lib-config.js",
6
6
  "packageManager": "yarn@4.6.0",
@@ -28,25 +28,28 @@
28
28
  "src/**/*"
29
29
  ],
30
30
  "peerDependencies": {
31
- "eslint": ">= 9.18.0"
31
+ "eslint": ">= 9.19.0"
32
32
  },
33
33
  "dependencies": {
34
- "@eslint/js": "^9.18.0",
35
- "@typescript-eslint/eslint-plugin": "^8.20.0",
36
- "@typescript-eslint/parser": "^8.20.0",
34
+ "@eslint/js": "^9.19.0",
35
+ "@stylistic/eslint-plugin-js": "^3.0.0",
36
+ "@stylistic/eslint-plugin-ts": "^3.0.0",
37
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
38
+ "@typescript-eslint/parser": "^8.21.0",
39
+ "angular-eslint": "^18.4.2",
37
40
  "eslint-config-prettier": "^10.0.1",
38
41
  "eslint-plugin-import": "^2.31.0",
39
- "eslint-plugin-jsdoc": "^50.6.2",
42
+ "eslint-plugin-jsdoc": "^50.6.3",
40
43
  "eslint-plugin-prettier": "^5.2.3",
41
44
  "eslint-plugin-svelte": "^2.46.1",
42
45
  "prettier-plugin-svelte": "^3.3.3",
43
- "typescript-eslint": "^8.20.0"
46
+ "typescript-eslint": "^8.21.0"
44
47
  },
45
48
  "devDependencies": {
46
- "@types/node": "^20.16.5",
47
- "eslint": "^9.18.0",
49
+ "@types/node": "^22.10.10",
50
+ "eslint": "^9.19.0",
48
51
  "prettier": "^3.4.2",
49
52
  "svelte": "^4.2.19",
50
- "typescript": "^5.6.2"
53
+ "typescript": "^5.7.3"
51
54
  }
52
55
  }
@@ -0,0 +1,213 @@
1
+ // Allows us to bring in the recommended core rules from eslint itself
2
+ import eslint from '@eslint/js';
3
+
4
+ // Allows us to use the typed utility for our config, and to bring in the recommended rules for TypeScript projects from typescript-eslint
5
+ import tseslint from 'typescript-eslint';
6
+
7
+ // Allows us to bring in the recommended rules for Angular projects from angular-eslint
8
+ import angular from 'angular-eslint';
9
+
10
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
11
+ import eslintPluginImport from 'eslint-plugin-import';
12
+ import eslintPluginJsdoc from 'eslint-plugin-jsdoc';
13
+ import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
14
+ import stylisticJs from '@stylistic/eslint-plugin-js';
15
+ import stylisticTs from '@stylistic/eslint-plugin-ts';
16
+
17
+ // Export our config array, which is composed together thanks to the typed utility function from typescript-eslint
18
+ export default tseslint.config(
19
+ {
20
+ // Everything in this config object targets our TypeScript files (Components, Directives, Pipes etc)
21
+ files: ['**/*.ts'],
22
+ extends: [
23
+ // Apply the recommended core rules
24
+ eslint.configs.recommended,
25
+ // Apply the recommended TypeScript rules
26
+ ...tseslint.configs.recommended,
27
+ // Optionally apply stylistic rules from typescript-eslint that improve code consistency
28
+ // Commented out for now, but these do seem nice while testing.
29
+ // ...tseslint.configs.stylistic,
30
+ // Apply the recommended Angular rules
31
+ ...angular.configs.tsRecommended,
32
+ // Apply prettier styling rules last
33
+ eslintPluginPrettierRecommended
34
+ ],
35
+ // Plugins are brought in using the name they use in the rule. So 'import/no-deprecated' needs 'import'
36
+ plugins: {
37
+ import: eslintPluginImport,
38
+ jsdoc: eslintPluginJsdoc,
39
+ 'unused-imports': eslintPluginUnusedImports,
40
+ '@stylistic/js': stylisticJs,
41
+ '@stylistic/ts': stylisticTs
42
+ },
43
+ // Set the custom processor which will allow us to have our inline Component templates extracted
44
+ // and treated as if they are HTML files (and therefore have the .html config below applied to them)
45
+ processor: angular.processInlineTemplates,
46
+ // Override specific rules for TypeScript files (these will take priority over the extended configs above)
47
+ rules: {
48
+ '@angular-eslint/component-selector': [
49
+ 'error',
50
+ {
51
+ type: 'element',
52
+ style: 'kebab-case'
53
+ }
54
+ ],
55
+ // The below rule should be set as an error but it happens in so many files
56
+ // it would take a lot of effort to convert and test everything.
57
+ '@angular-eslint/no-host-metadata-property': 'warn',
58
+ '@angular-eslint/component-class-suffix': [
59
+ 'warn',
60
+ {
61
+ suffixes: ['Component', 'Page']
62
+ }
63
+ ],
64
+ // Below rule was turned off to allow for member-ordering to take
65
+ // precedence.
66
+ '@typescript-eslint/adjacent-overload-signatures': 'off',
67
+ '@typescript-eslint/no-empty-object-type': 'warn',
68
+ '@typescript-eslint/no-unsafe-function-type': 'warn',
69
+ '@stylistic/ts/member-delimiter-style': [
70
+ 'error',
71
+ {
72
+ multiline: {
73
+ delimiter: 'semi',
74
+ requireLast: true
75
+ },
76
+ singleline: {
77
+ delimiter: 'semi',
78
+ requireLast: false
79
+ }
80
+ }
81
+ ],
82
+ '@typescript-eslint/member-ordering': 'warn',
83
+ '@typescript-eslint/no-empty-function': 'off',
84
+ '@typescript-eslint/no-empty-interface': 'warn',
85
+ '@typescript-eslint/no-explicit-any': 'off',
86
+ // The below rule is handled by unused-imports/no-unused-vars
87
+ '@typescript-eslint/no-unused-vars': 'off',
88
+ '@typescript-eslint/no-non-null-assertion': 'error',
89
+ '@typescript-eslint/no-shadow': [
90
+ 'error',
91
+ {
92
+ hoist: 'all'
93
+ }
94
+ ],
95
+ '@typescript-eslint/no-var-requires': 'off',
96
+ '@typescript-eslint/no-inferrable-types': 'off',
97
+ '@typescript-eslint/prefer-for-of': 'error',
98
+ '@typescript-eslint/prefer-function-type': 'error',
99
+ '@typescript-eslint/triple-slash-reference': [
100
+ 'error',
101
+ {
102
+ path: 'always',
103
+ types: 'prefer-import',
104
+ lib: 'always'
105
+ }
106
+ ],
107
+ '@stylistic/ts/type-annotation-spacing': 'error',
108
+ '@typescript-eslint/typedef': 'off',
109
+ '@typescript-eslint/unified-signatures': 'error',
110
+ 'arrow-body-style': 'error',
111
+ // The below is cyclomatic complexity. We might want to set this to something to help with
112
+ // SonarCloud scores before it gets there. 😁
113
+ complexity: 'off',
114
+ 'constructor-super': 'error',
115
+ 'dot-notation': 'error',
116
+ // Turned off because it is throwing errors as of 7/17/2024. See the following
117
+ // GitHub links:
118
+ // Link to GitHub PR: https://github.com/import-js/eslint-plugin-import/pull/2996
119
+ // Link to bug: https://github.com/eslint/eslint/issues/17953
120
+ 'import/no-deprecated': 'off',
121
+ 'import/order': [
122
+ 'warn',
123
+ {
124
+ alphabetize: {
125
+ order:
126
+ 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
127
+ caseInsensitive: true /* ignore case. Options: [true, false] */
128
+ },
129
+ 'newlines-between': 'never'
130
+ }
131
+ ],
132
+ 'jsdoc/check-alignment': 'error',
133
+ 'jsdoc/check-indentation': 'warn',
134
+ 'jsdoc/no-types': 'error',
135
+ '@stylistic/js/max-len': [
136
+ 'warn',
137
+ {
138
+ code: 140,
139
+ ignoreStrings: true
140
+ }
141
+ ],
142
+ '@stylistic/js/new-parens': 'error',
143
+ 'no-bitwise': 'error',
144
+ 'no-caller': 'error',
145
+ // So we don't accidentally assign a variable in an if-condition
146
+ 'no-cond-assign': 'error',
147
+ 'no-debugger': 'error',
148
+ 'no-eval': 'error',
149
+ 'no-fallthrough': 'error',
150
+ 'no-restricted-imports': ['error', 'rxjs/Rx'],
151
+ 'no-throw-literal': 'error',
152
+ 'no-undef-init': 'error',
153
+ // Custom configuration for underscore dangle for use of
154
+ // backing values in classes when no other option is available.
155
+ 'no-underscore-dangle': [
156
+ 'warn',
157
+ {
158
+ enforceInMethodNames: true,
159
+ allowAfterThis: true
160
+ }
161
+ ],
162
+ 'no-unsafe-finally': 'error',
163
+ 'no-unused-expressions': 'error',
164
+ 'no-unused-labels': 'error',
165
+ 'one-var': ['error', 'never'],
166
+ '@stylistic/js/quote-props': ['error', 'as-needed'],
167
+ '@stylistic/js/spaced-comment': [
168
+ 'error',
169
+ 'always',
170
+ {
171
+ markers: ['/']
172
+ }
173
+ ],
174
+ 'use-isnan': 'error',
175
+ //The following removes unused imports
176
+ 'no-unused-vars': 'off',
177
+ 'unused-imports/no-unused-imports': 'error',
178
+ 'unused-imports/no-unused-vars': [
179
+ 'warn',
180
+ {
181
+ vars: 'all',
182
+ varsIgnorePattern: '^_',
183
+ args: 'after-used',
184
+ argsIgnorePattern: '^_'
185
+ }
186
+ ]
187
+ }
188
+ },
189
+ {
190
+ // Everything in this config object targets our HTML files (external templates,
191
+ // and inline templates as long as we have the `processor` set on our TypeScript config above)
192
+ files: ['**/*.html'],
193
+ extends: [
194
+ // Apply the recommended Angular template rules
195
+ ...angular.configs.templateRecommended,
196
+ // Apply the Angular template rules which focus on accessibility.
197
+ // Commented for now, but this should ideally be turned back on in
198
+ // the future.
199
+ // ...angular.configs.templateAccessibility,
200
+ // Apply the prettier config
201
+ eslintPluginPrettierRecommended
202
+ ],
203
+ rules: {
204
+ 'prettier/prettier': [
205
+ 'error',
206
+ {
207
+ parser: 'angular',
208
+ endOfLine: 'auto'
209
+ }
210
+ ]
211
+ }
212
+ }
213
+ );