eslint-config-cityssm 32.3.2 → 33.0.0

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 CHANGED
@@ -17,28 +17,26 @@ npm install --save-dev eslint-config-cityssm
17
17
 
18
18
  ## Simple Usage
19
19
 
20
- In the project's `eslint.config.js` file,
21
- it's as easy as one line.
20
+ For web applications, export the default export.
22
21
 
23
22
  ```javascript
24
23
  export { default } from 'eslint-config-cityssm'
25
24
  ```
26
25
 
27
- For web applications, export `configWebApp` instead.
26
+ For simpler packages, export the `packageConfig`.
28
27
 
29
28
  ```javascript
30
- export { configWebApp as default } from 'eslint-config-cityssm'
29
+ export { default } from 'eslint-config-cityssm/packageConfig'
31
30
  ```
32
31
 
33
32
  ## Advanced Usage (TypeScript)
34
33
 
35
34
  ```typescript
36
- import {
35
+ import default as configWebApp {
37
36
  type ConfigObject,
38
- configWebApp,
39
- cspellWords,
40
37
  defineConfig
41
38
  } from 'eslint-config-cityssm'
39
+ import { cspellWords } from 'eslint-config-cityssm/exports'
42
40
 
43
41
  export const config: ConfigObject[] = defineConfig(configWebApp, {
44
42
  files: ['**/*.ts'],
@@ -1,10 +1,8 @@
1
1
  import type { ConfigObject } from '@eslint/core';
2
+ /**
3
+ * ESLint Configuration for Web Applications
4
+ */
2
5
  export declare const config: ConfigObject[];
3
- export declare const configWebApp: ConfigObject[];
4
- export { default as cspellFlagWords } from './lists/cspell.flagWords.js';
5
- export { default as cspellWords } from './lists/cspell.words.js';
6
- export { httpStatusCodes as noMagicNumbersHttpStatusCodes, default as noMagicNumbersIgnore } from './lists/noMagicNumbers.ignore.js';
7
- export { default as writeGoodCommentsWhitelist } from './lists/writeGoodComments.whitelist.js';
6
+ export default config;
8
7
  export type { ConfigObject } from '@eslint/core';
9
8
  export { defineConfig } from 'eslint/config';
10
- export default config;
package/eslint.config.js CHANGED
@@ -1,228 +1,16 @@
1
1
  // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
2
- /* eslint-disable @cspell/spellchecker, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
3
- import eslintCspellRecommended from '@cspell/eslint-plugin/recommended';
4
- import eslintPluginEslintComments from '@eslint-community/eslint-plugin-eslint-comments/configs';
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
3
  import eslintCss from '@eslint/css';
6
- import eslintJs from '@eslint/js';
7
- import eslintJson from '@eslint/json';
8
- import eslintMarkdown from '@eslint/markdown';
9
4
  import eslintHtml from '@html-eslint/eslint-plugin';
10
5
  import htmlParser from '@html-eslint/parser';
11
- import eslintConfigLove from 'eslint-config-love';
12
- import eslintPluginJsdoc from 'eslint-plugin-jsdoc';
13
- import eslintPluginNoSecrets from 'eslint-plugin-no-secrets';
14
6
  import eslintPluginNoUnsanitized from 'eslint-plugin-no-unsanitized';
15
- import eslintPluginPackageJson from 'eslint-plugin-package-json';
16
- import eslintPluginPerfectionist from 'eslint-plugin-perfectionist';
17
- import * as eslintPluginRegexp from 'eslint-plugin-regexp';
18
- import eslintPluginSecurity from 'eslint-plugin-security';
19
- import eslintPluginSonarJs from 'eslint-plugin-sonarjs';
20
- import eslintPluginUnicorn from 'eslint-plugin-unicorn';
21
- // import * as eslintPluginWoke from 'eslint-plugin-woke'
22
- import * as eslintPluginWriteGoodComments from 'eslint-plugin-write-good-comments';
23
7
  import { defineConfig } from 'eslint/config';
24
- import tseslint from 'typescript-eslint';
25
- import cspellFlagWords from './lists/cspell.flagWords.js';
26
- import cspellWords from './lists/cspell.words.js';
8
+ import packageConfig from './eslint.packageConfig.js';
27
9
  import noMagicNumbers, { httpStatusCodes } from './lists/noMagicNumbers.ignore.js';
28
- import writeGoodCommentsWhitelist from './lists/writeGoodComments.whitelist.js';
29
- export const config = defineConfig({
30
- linterOptions: {
31
- reportUnusedDisableDirectives: 'error',
32
- reportUnusedInlineConfigs: 'error'
33
- }
34
- }, eslintPluginPackageJson.configs.recommended, {
35
- extends: [
36
- tseslint.configs.recommendedTypeChecked,
37
- tseslint.configs.stylisticTypeChecked,
38
- eslintJs.configs.recommended,
39
- eslintCspellRecommended,
40
- eslintPluginEslintComments.recommended,
41
- eslintPluginJsdoc.configs['flat/recommended-typescript'],
42
- eslintPluginPerfectionist.configs['recommended-natural'],
43
- eslintPluginRegexp.configs['flat/recommended'],
44
- eslintPluginSecurity.configs.recommended,
45
- eslintPluginSonarJs.configs.recommended,
46
- eslintPluginUnicorn.configs.recommended,
47
- eslintConfigLove
48
- ],
49
- files: ['**/*.ts', '**/*.js'],
50
- ignores: ['**/*.d.ts'],
51
- languageOptions: {
52
- parserOptions: {
53
- ecmaFeatures: { modules: true },
54
- ecmaVersion: 2022,
55
- project: true,
56
- sourceType: 'module'
57
- }
58
- },
59
- plugins: {
60
- 'no-secrets': eslintPluginNoSecrets,
61
- // sonarjs: eslintPluginSonarJs,
62
- // unicorn: eslintPluginUnicorn,
63
- // woke: eslintPluginWoke,
64
- 'write-good-comments': eslintPluginWriteGoodComments
65
- },
66
- rules: {
67
- '@cspell/spellchecker': [
68
- 'warn',
69
- {
70
- cspell: {
71
- flagWords: cspellFlagWords,
72
- language: 'en-CA,en-US,en-GB',
73
- words: cspellWords
74
- }
75
- }
76
- ],
77
- '@typescript-eslint/init-declarations': 'warn',
78
- '@typescript-eslint/no-magic-numbers': [
79
- 'warn',
80
- {
81
- ignore: noMagicNumbers
82
- }
83
- ],
84
- '@typescript-eslint/no-misused-promises': 'warn',
85
- '@typescript-eslint/no-non-null-assertion': 'warn',
86
- '@typescript-eslint/no-unnecessary-type-assertion': 'off',
87
- '@typescript-eslint/no-unsafe-argument': 'warn',
88
- '@typescript-eslint/no-unsafe-assignment': 'warn',
89
- '@typescript-eslint/no-unsafe-call': 'warn',
90
- '@typescript-eslint/no-unsafe-member-access': 'warn',
91
- '@typescript-eslint/no-unsafe-type-assertion': 'warn',
92
- '@typescript-eslint/non-nullable-type-assertion-style': 'off',
93
- '@typescript-eslint/prefer-destructuring': 'off',
94
- '@typescript-eslint/restrict-plus-operands': 'warn',
95
- '@typescript-eslint/space-before-function-paren': 'off',
96
- '@typescript-eslint/strict-boolean-expressions': 'warn',
97
- complexity: [
98
- 'warn',
99
- {
100
- max: 20
101
- }
102
- ],
103
- 'eslint-comments/require-description': 'off',
104
- 'jsdoc/require-jsdoc': ['warn', { publicOnly: true }],
105
- 'n/no-missing-import': 'off',
106
- 'no-extra-semi': 'off',
107
- 'no-param-reassign': ['error', { props: false }],
108
- 'no-redeclare': 'off',
109
- 'no-secrets/no-secrets': 'error',
110
- 'no-undef': 'off',
111
- // checked by "@typescript-eslint/no-unused-vars"
112
- 'no-unused-vars': 'off',
113
- 'perfectionist/sort-imports': [
114
- 'error',
115
- {
116
- groups: [
117
- 'builtin',
118
- ['external', 'internal-type', 'internal', 'type'],
119
- ['parent-type', 'parent'],
120
- ['sibling-type', 'sibling'],
121
- 'unknown'
122
- ],
123
- partitionByNewLine: false
124
- }
125
- ],
126
- 'perfectionist/sort-interfaces': 'warn',
127
- 'perfectionist/sort-modules': 'warn',
128
- 'perfectionist/sort-named-exports': [
129
- 'error',
130
- {
131
- groupKind: 'types-first'
132
- }
133
- ],
134
- 'perfectionist/sort-named-imports': [
135
- 'error',
136
- {
137
- groupKind: 'types-first'
138
- }
139
- ],
140
- 'perfectionist/sort-object-types': 'warn',
141
- 'perfectionist/sort-objects': 'warn',
142
- 'perfectionist/sort-union-types': [
143
- 'error',
144
- {
145
- groups: ['unknown', 'nullish']
146
- }
147
- ],
148
- // checked by "no-useless-escape"
149
- 'regexp/no-useless-escape': 'off',
150
- // checked by "complexity"
151
- 'sonarjs/cognitive-complexity': 'off',
152
- 'sonarjs/different-types-comparison': 'off',
153
- // checked by "regexp/no-dupe-characters-character-class"
154
- 'sonarjs/duplicates-in-character-class': 'off',
155
- 'sonarjs/no-duplicate-string': 'warn',
156
- // checked by "@typescript-eslint/no-misused-promises"
157
- 'sonarjs/no-misused-promises': 'off',
158
- // checked by "@typescript-eslint/no-redundant-type-constituents"
159
- 'sonarjs/no-redundant-type-constituents': 'off',
160
- 'sonarjs/unnecessary-character-escapes': 'off',
161
- 'unicorn/consistent-function-scoping': 'warn',
162
- 'unicorn/empty-brace-spaces': 'off',
163
- 'unicorn/filename-case': [
164
- 'error',
165
- {
166
- case: 'camelCase',
167
- ignore: ['DB', 'URL']
168
- }
169
- ],
170
- 'unicorn/prevent-abbreviations': [
171
- 'error',
172
- {
173
- replacements: {
174
- def: {
175
- definition: true
176
- },
177
- ele: {
178
- element: true
179
- },
180
- eles: {
181
- elements: true
182
- },
183
- fns: {
184
- functions: true
185
- },
186
- res: {
187
- result: false
188
- },
189
- temp: {
190
- temporary: false
191
- }
192
- }
193
- }
194
- ],
195
- // 'woke/all': 'error',
196
- 'write-good-comments/write-good-comments': [
197
- 'warn',
198
- {
199
- passive: false,
200
- whitelist: writeGoodCommentsWhitelist
201
- }
202
- ]
203
- },
204
- settings: {
205
- perfectionist: {
206
- partitionByNewLine: true
207
- }
208
- }
209
- }, {
210
- extends: [eslintJson.configs.recommended],
211
- files: ['**/*.json'],
212
- ignores: ['**/package.json', '**/package-lock.json'],
213
- language: 'json/json',
214
- plugins: {
215
- json: eslintJson
216
- }
217
- }, {
218
- extends: [eslintMarkdown.configs.recommended],
219
- files: ['**/*.md'],
220
- language: 'markdown/gfm',
221
- plugins: {
222
- markdown: eslintMarkdown
223
- }
224
- });
225
- export const configWebApp = defineConfig(config, {
10
+ /**
11
+ * ESLint Configuration for Web Applications
12
+ */
13
+ export const config = defineConfig(packageConfig, {
226
14
  files: ['**/*.ts', '**/*.js'],
227
15
  ignores: ['**/*.d.ts'],
228
16
  plugins: {
@@ -274,8 +62,8 @@ export const configWebApp = defineConfig(config, {
274
62
  parserOptions: {
275
63
  templateEngineSyntax: {
276
64
  '<%': '%>',
277
- '<%=': '%>',
278
- '<%-': '%>'
65
+ '<%-': '%>',
66
+ '<%=': '%>'
279
67
  }
280
68
  }
281
69
  },
@@ -333,12 +121,9 @@ export const configWebApp = defineConfig(config, {
333
121
  { pattern: 'on.*' }
334
122
  ]
335
123
  }
336
- ]
124
+ ],
125
+ 'html/use-baseline': 'warn'
337
126
  }
338
127
  });
339
- export { default as cspellFlagWords } from './lists/cspell.flagWords.js';
340
- export { default as cspellWords } from './lists/cspell.words.js';
341
- export { httpStatusCodes as noMagicNumbersHttpStatusCodes, default as noMagicNumbersIgnore } from './lists/noMagicNumbers.ignore.js';
342
- export { default as writeGoodCommentsWhitelist } from './lists/writeGoodComments.whitelist.js';
343
- export { defineConfig } from 'eslint/config';
344
128
  export default config;
129
+ export { defineConfig } from 'eslint/config';
package/eslint.config.ts CHANGED
@@ -1,270 +1,23 @@
1
1
  // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
2
- /* eslint-disable @cspell/spellchecker, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
3
 
4
- import eslintCspellRecommended from '@cspell/eslint-plugin/recommended'
5
- import eslintPluginEslintComments from '@eslint-community/eslint-plugin-eslint-comments/configs'
6
4
  import type { ConfigObject } from '@eslint/core'
7
5
  import eslintCss from '@eslint/css'
8
- import eslintJs from '@eslint/js'
9
- import eslintJson from '@eslint/json'
10
- import eslintMarkdown from '@eslint/markdown'
11
6
  import eslintHtml from '@html-eslint/eslint-plugin'
12
7
  import htmlParser from '@html-eslint/parser'
13
- import eslintConfigLove from 'eslint-config-love'
14
- import eslintPluginJsdoc from 'eslint-plugin-jsdoc'
15
- import eslintPluginNoSecrets from 'eslint-plugin-no-secrets'
16
8
  import eslintPluginNoUnsanitized from 'eslint-plugin-no-unsanitized'
17
- import eslintPluginPackageJson from 'eslint-plugin-package-json'
18
- import eslintPluginPerfectionist from 'eslint-plugin-perfectionist'
19
- import * as eslintPluginRegexp from 'eslint-plugin-regexp'
20
- import eslintPluginSecurity from 'eslint-plugin-security'
21
- import eslintPluginSonarJs from 'eslint-plugin-sonarjs'
22
- import eslintPluginUnicorn from 'eslint-plugin-unicorn'
23
- // import * as eslintPluginWoke from 'eslint-plugin-woke'
24
- import * as eslintPluginWriteGoodComments from 'eslint-plugin-write-good-comments'
25
9
  import { defineConfig } from 'eslint/config'
26
- import tseslint from 'typescript-eslint'
27
10
 
28
- import cspellFlagWords from './lists/cspell.flagWords.js'
29
- import cspellWords from './lists/cspell.words.js'
11
+ import packageConfig from './eslint.packageConfig.js'
30
12
  import noMagicNumbers, {
31
13
  httpStatusCodes
32
14
  } from './lists/noMagicNumbers.ignore.js'
33
- import writeGoodCommentsWhitelist from './lists/writeGoodComments.whitelist.js'
34
15
 
16
+ /**
17
+ * ESLint Configuration for Web Applications
18
+ */
35
19
  export const config: ConfigObject[] = defineConfig(
36
- {
37
- linterOptions: {
38
- reportUnusedDisableDirectives: 'error',
39
- reportUnusedInlineConfigs: 'error'
40
- }
41
- },
42
- eslintPluginPackageJson.configs.recommended,
43
- {
44
- extends: [
45
- tseslint.configs.recommendedTypeChecked,
46
- tseslint.configs.stylisticTypeChecked,
47
-
48
- eslintJs.configs.recommended,
49
-
50
- eslintCspellRecommended,
51
- eslintPluginEslintComments.recommended,
52
- eslintPluginJsdoc.configs['flat/recommended-typescript'],
53
- eslintPluginPerfectionist.configs['recommended-natural'],
54
- eslintPluginRegexp.configs['flat/recommended'],
55
- eslintPluginSecurity.configs.recommended,
56
- eslintPluginSonarJs.configs.recommended,
57
- eslintPluginUnicorn.configs.recommended,
58
- eslintConfigLove
59
- ],
60
- files: ['**/*.ts', '**/*.js'],
61
- ignores: ['**/*.d.ts'],
62
- languageOptions: {
63
- parserOptions: {
64
- ecmaFeatures: { modules: true },
65
- ecmaVersion: 2022,
66
- project: true,
67
- sourceType: 'module'
68
- }
69
- },
70
-
71
- plugins: {
72
- 'no-secrets': eslintPluginNoSecrets,
73
- // sonarjs: eslintPluginSonarJs,
74
- // unicorn: eslintPluginUnicorn,
75
- // woke: eslintPluginWoke,
76
- 'write-good-comments': eslintPluginWriteGoodComments
77
- },
78
-
79
- rules: {
80
- '@cspell/spellchecker': [
81
- 'warn',
82
- {
83
- cspell: {
84
- flagWords: cspellFlagWords,
85
- language: 'en-CA,en-US,en-GB',
86
- words: cspellWords
87
- }
88
- }
89
- ],
90
-
91
- '@typescript-eslint/init-declarations': 'warn',
92
- '@typescript-eslint/no-magic-numbers': [
93
- 'warn',
94
- {
95
- ignore: noMagicNumbers
96
- }
97
- ],
98
- '@typescript-eslint/no-misused-promises': 'warn',
99
- '@typescript-eslint/no-non-null-assertion': 'warn',
100
- '@typescript-eslint/no-unnecessary-type-assertion': 'off',
101
-
102
- '@typescript-eslint/no-unsafe-argument': 'warn',
103
- '@typescript-eslint/no-unsafe-assignment': 'warn',
104
- '@typescript-eslint/no-unsafe-call': 'warn',
105
- '@typescript-eslint/no-unsafe-member-access': 'warn',
106
- '@typescript-eslint/no-unsafe-type-assertion': 'warn',
107
-
108
- '@typescript-eslint/non-nullable-type-assertion-style': 'off',
109
- '@typescript-eslint/prefer-destructuring': 'off',
110
- '@typescript-eslint/restrict-plus-operands': 'warn',
111
- '@typescript-eslint/space-before-function-paren': 'off',
112
- '@typescript-eslint/strict-boolean-expressions': 'warn',
113
-
114
- complexity: [
115
- 'warn',
116
- {
117
- max: 20
118
- }
119
- ],
120
-
121
- 'eslint-comments/require-description': 'off',
122
-
123
- 'jsdoc/require-jsdoc': ['warn', { publicOnly: true }],
124
-
125
- 'n/no-missing-import': 'off',
126
-
127
- 'no-extra-semi': 'off',
128
-
129
- 'no-param-reassign': ['error', { props: false }],
130
-
131
- 'no-redeclare': 'off',
132
- 'no-secrets/no-secrets': 'error',
133
- 'no-undef': 'off',
134
-
135
- // checked by "@typescript-eslint/no-unused-vars"
136
- 'no-unused-vars': 'off',
137
-
138
- 'perfectionist/sort-imports': [
139
- 'error',
140
- {
141
- groups: [
142
- 'builtin',
143
- ['external', 'internal-type', 'internal', 'type'],
144
- ['parent-type', 'parent'],
145
- ['sibling-type', 'sibling'],
146
- 'unknown'
147
- ],
148
- partitionByNewLine: false
149
- }
150
- ],
151
- 'perfectionist/sort-interfaces': 'warn',
152
- 'perfectionist/sort-modules': 'warn',
153
- 'perfectionist/sort-named-exports': [
154
- 'error',
155
- {
156
- groupKind: 'types-first'
157
- }
158
- ],
159
- 'perfectionist/sort-named-imports': [
160
- 'error',
161
- {
162
- groupKind: 'types-first'
163
- }
164
- ],
165
- 'perfectionist/sort-object-types': 'warn',
166
- 'perfectionist/sort-objects': 'warn',
167
-
168
- 'perfectionist/sort-union-types': [
169
- 'error',
170
- {
171
- groups: ['unknown', 'nullish']
172
- }
173
- ],
174
-
175
- // checked by "no-useless-escape"
176
- 'regexp/no-useless-escape': 'off',
177
-
178
- // checked by "complexity"
179
- 'sonarjs/cognitive-complexity': 'off',
180
-
181
- 'sonarjs/different-types-comparison': 'off',
182
-
183
- // checked by "regexp/no-dupe-characters-character-class"
184
- 'sonarjs/duplicates-in-character-class': 'off',
185
-
186
- 'sonarjs/no-duplicate-string': 'warn',
187
-
188
- // checked by "@typescript-eslint/no-misused-promises"
189
- 'sonarjs/no-misused-promises': 'off',
190
-
191
- // checked by "@typescript-eslint/no-redundant-type-constituents"
192
- 'sonarjs/no-redundant-type-constituents': 'off',
193
-
194
- 'sonarjs/unnecessary-character-escapes': 'off',
195
-
196
- 'unicorn/consistent-function-scoping': 'warn',
197
- 'unicorn/empty-brace-spaces': 'off',
198
- 'unicorn/filename-case': [
199
- 'error',
200
- {
201
- case: 'camelCase',
202
- ignore: ['DB', 'URL']
203
- }
204
- ],
205
- 'unicorn/prevent-abbreviations': [
206
- 'error',
207
- {
208
- replacements: {
209
- def: {
210
- definition: true
211
- },
212
- ele: {
213
- element: true
214
- },
215
- eles: {
216
- elements: true
217
- },
218
- fns: {
219
- functions: true
220
- },
221
- res: {
222
- result: false
223
- },
224
- temp: {
225
- temporary: false
226
- }
227
- }
228
- }
229
- ],
230
-
231
- // 'woke/all': 'error',
232
-
233
- 'write-good-comments/write-good-comments': [
234
- 'warn',
235
- {
236
- passive: false,
237
- whitelist: writeGoodCommentsWhitelist
238
- }
239
- ]
240
- },
241
- settings: {
242
- perfectionist: {
243
- partitionByNewLine: true
244
- }
245
- }
246
- },
247
- {
248
- extends: [eslintJson.configs.recommended],
249
- files: ['**/*.json'],
250
- ignores: ['**/package.json', '**/package-lock.json'],
251
- language: 'json/json',
252
- plugins: {
253
- json: eslintJson
254
- }
255
- },
256
- {
257
- extends: [eslintMarkdown.configs.recommended],
258
- files: ['**/*.md'],
259
- language: 'markdown/gfm',
260
- plugins: {
261
- markdown: eslintMarkdown
262
- }
263
- }
264
- )
265
-
266
- export const configWebApp: ConfigObject[] = defineConfig(
267
- config,
20
+ packageConfig,
268
21
  {
269
22
  files: ['**/*.ts', '**/*.js'],
270
23
  ignores: ['**/*.d.ts'],
@@ -325,8 +78,8 @@ export const configWebApp: ConfigObject[] = defineConfig(
325
78
  parserOptions: {
326
79
  templateEngineSyntax: {
327
80
  '<%': '%>',
328
- '<%=': '%>',
329
- '<%-': '%>'
81
+ '<%-': '%>',
82
+ '<%=': '%>'
330
83
  }
331
84
  }
332
85
  },
@@ -389,22 +142,13 @@ export const configWebApp: ConfigObject[] = defineConfig(
389
142
  { pattern: 'on.*' }
390
143
  ]
391
144
  }
392
- ]
145
+ ],
146
+ 'html/use-baseline': 'warn'
393
147
  }
394
148
  }
395
149
  )
396
150
 
397
- export { default as cspellFlagWords } from './lists/cspell.flagWords.js'
398
- export { default as cspellWords } from './lists/cspell.words.js'
399
-
400
- export {
401
- httpStatusCodes as noMagicNumbersHttpStatusCodes,
402
- default as noMagicNumbersIgnore
403
- } from './lists/noMagicNumbers.ignore.js'
404
-
405
- export { default as writeGoodCommentsWhitelist } from './lists/writeGoodComments.whitelist.js'
151
+ export default config
406
152
 
407
153
  export type { ConfigObject } from '@eslint/core'
408
154
  export { defineConfig } from 'eslint/config'
409
-
410
- export default config
@@ -0,0 +1,8 @@
1
+ import type { ConfigObject } from '@eslint/core';
2
+ /**
3
+ * ESLint Configuration for General TypeScript/JavaScript Projects
4
+ */
5
+ export declare const config: ConfigObject[];
6
+ export default config;
7
+ export type { ConfigObject } from '@eslint/core';
8
+ export { defineConfig } from 'eslint/config';
@@ -0,0 +1,222 @@
1
+ import eslintCspellRecommended from '@cspell/eslint-plugin/recommended';
2
+ import eslintPluginEslintComments from '@eslint-community/eslint-plugin-eslint-comments/configs';
3
+ import eslintJs from '@eslint/js';
4
+ import eslintJson from '@eslint/json';
5
+ import eslintMarkdown from '@eslint/markdown';
6
+ import eslintConfigLove from 'eslint-config-love';
7
+ import eslintPluginJsdoc from 'eslint-plugin-jsdoc';
8
+ import eslintPluginNoSecrets from 'eslint-plugin-no-secrets';
9
+ import eslintPluginPackageJson from 'eslint-plugin-package-json';
10
+ import eslintPluginPerfectionist from 'eslint-plugin-perfectionist';
11
+ import * as eslintPluginRegexp from 'eslint-plugin-regexp';
12
+ import eslintPluginSecurity from 'eslint-plugin-security';
13
+ import eslintPluginSonarJs from 'eslint-plugin-sonarjs';
14
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
15
+ import * as eslintPluginWriteGoodComments from 'eslint-plugin-write-good-comments';
16
+ import { defineConfig } from 'eslint/config';
17
+ import tseslint from 'typescript-eslint';
18
+ import cspellFlagWords from './lists/cspell.flagWords.js';
19
+ import cspellWords from './lists/cspell.words.js';
20
+ import noMagicNumbers from './lists/noMagicNumbers.ignore.js';
21
+ import writeGoodCommentsAllowlist from './lists/writeGoodComments.allowlist.js';
22
+ /**
23
+ * ESLint Configuration for General TypeScript/JavaScript Projects
24
+ */
25
+ export const config = defineConfig({
26
+ linterOptions: {
27
+ reportUnusedDisableDirectives: 'error',
28
+ reportUnusedInlineConfigs: 'error'
29
+ }
30
+ }, eslintPluginPackageJson.configs.recommended, {
31
+ extends: [
32
+ tseslint.configs.recommendedTypeChecked,
33
+ tseslint.configs.stylisticTypeChecked,
34
+ eslintJs.configs.recommended,
35
+ eslintCspellRecommended,
36
+ eslintPluginEslintComments.recommended,
37
+ eslintPluginJsdoc.configs['flat/recommended-typescript'],
38
+ eslintPluginPerfectionist.configs['recommended-natural'],
39
+ eslintPluginRegexp.configs['flat/recommended'],
40
+ eslintPluginSecurity.configs.recommended,
41
+ eslintPluginSonarJs.configs.recommended,
42
+ eslintPluginUnicorn.configs.recommended,
43
+ eslintConfigLove
44
+ ],
45
+ files: ['**/*.ts', '**/*.js'],
46
+ ignores: ['**/*.d.ts'],
47
+ languageOptions: {
48
+ parserOptions: {
49
+ ecmaFeatures: { modules: true },
50
+ ecmaVersion: 2022,
51
+ project: true,
52
+ sourceType: 'module'
53
+ }
54
+ },
55
+ plugins: {
56
+ 'no-secrets': eslintPluginNoSecrets,
57
+ // sonarjs: eslintPluginSonarJs,
58
+ // unicorn: eslintPluginUnicorn,
59
+ // woke: eslintPluginWoke,
60
+ 'write-good-comments': eslintPluginWriteGoodComments
61
+ },
62
+ rules: {
63
+ '@cspell/spellchecker': [
64
+ 'warn',
65
+ {
66
+ cspell: {
67
+ flagWords: cspellFlagWords,
68
+ language: 'en-CA,en-US,en-GB',
69
+ words: cspellWords
70
+ }
71
+ }
72
+ ],
73
+ '@typescript-eslint/init-declarations': 'warn',
74
+ '@typescript-eslint/no-magic-numbers': [
75
+ 'warn',
76
+ {
77
+ ignore: noMagicNumbers
78
+ }
79
+ ],
80
+ '@typescript-eslint/no-misused-promises': 'warn',
81
+ '@typescript-eslint/no-non-null-assertion': 'warn',
82
+ '@typescript-eslint/no-unnecessary-type-assertion': 'off',
83
+ '@typescript-eslint/no-unsafe-argument': 'warn',
84
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
85
+ '@typescript-eslint/no-unsafe-call': 'warn',
86
+ '@typescript-eslint/no-unsafe-member-access': 'warn',
87
+ '@typescript-eslint/no-unsafe-type-assertion': 'warn',
88
+ '@typescript-eslint/non-nullable-type-assertion-style': 'off',
89
+ '@typescript-eslint/prefer-destructuring': 'off',
90
+ '@typescript-eslint/restrict-plus-operands': 'warn',
91
+ '@typescript-eslint/space-before-function-paren': 'off',
92
+ '@typescript-eslint/strict-boolean-expressions': 'warn',
93
+ complexity: [
94
+ 'warn',
95
+ {
96
+ max: 20
97
+ }
98
+ ],
99
+ 'eslint-comments/require-description': 'off',
100
+ 'jsdoc/require-jsdoc': ['warn', { publicOnly: true }],
101
+ 'n/no-missing-import': 'off',
102
+ 'no-extra-semi': 'off',
103
+ 'no-param-reassign': ['error', { props: false }],
104
+ 'no-redeclare': 'off',
105
+ 'no-secrets/no-secrets': 'error',
106
+ 'no-undef': 'off',
107
+ // checked by "@typescript-eslint/no-unused-vars"
108
+ 'no-unused-vars': 'off',
109
+ 'perfectionist/sort-imports': [
110
+ 'error',
111
+ {
112
+ groups: [
113
+ 'builtin',
114
+ ['external', 'internal-type', 'internal', 'type'],
115
+ ['parent-type', 'parent'],
116
+ ['sibling-type', 'sibling'],
117
+ 'unknown'
118
+ ],
119
+ partitionByNewLine: false
120
+ }
121
+ ],
122
+ 'perfectionist/sort-interfaces': 'warn',
123
+ 'perfectionist/sort-modules': 'warn',
124
+ 'perfectionist/sort-named-exports': [
125
+ 'error',
126
+ {
127
+ groupKind: 'types-first'
128
+ }
129
+ ],
130
+ 'perfectionist/sort-named-imports': [
131
+ 'error',
132
+ {
133
+ groupKind: 'types-first'
134
+ }
135
+ ],
136
+ 'perfectionist/sort-object-types': 'warn',
137
+ 'perfectionist/sort-objects': 'warn',
138
+ 'perfectionist/sort-union-types': [
139
+ 'error',
140
+ {
141
+ groups: ['unknown', 'nullish']
142
+ }
143
+ ],
144
+ // checked by "no-useless-escape"
145
+ 'regexp/no-useless-escape': 'off',
146
+ // checked by "complexity"
147
+ 'sonarjs/cognitive-complexity': 'off',
148
+ 'sonarjs/different-types-comparison': 'off',
149
+ // checked by "regexp/no-dupe-characters-character-class"
150
+ 'sonarjs/duplicates-in-character-class': 'off',
151
+ 'sonarjs/no-duplicate-string': 'warn',
152
+ // checked by "@typescript-eslint/no-misused-promises"
153
+ 'sonarjs/no-misused-promises': 'off',
154
+ // checked by "@typescript-eslint/no-redundant-type-constituents"
155
+ 'sonarjs/no-redundant-type-constituents': 'off',
156
+ 'sonarjs/unnecessary-character-escapes': 'off',
157
+ 'unicorn/consistent-function-scoping': 'warn',
158
+ 'unicorn/empty-brace-spaces': 'off',
159
+ 'unicorn/filename-case': [
160
+ 'error',
161
+ {
162
+ case: 'camelCase',
163
+ ignore: ['DB', 'URL']
164
+ }
165
+ ],
166
+ 'unicorn/prevent-abbreviations': [
167
+ 'error',
168
+ {
169
+ replacements: {
170
+ def: {
171
+ definition: true
172
+ },
173
+ ele: {
174
+ element: true
175
+ },
176
+ eles: {
177
+ elements: true
178
+ },
179
+ fns: {
180
+ functions: true
181
+ },
182
+ res: {
183
+ result: false
184
+ },
185
+ temp: {
186
+ temporary: false
187
+ }
188
+ }
189
+ }
190
+ ],
191
+ // 'woke/all': 'error',
192
+ 'write-good-comments/write-good-comments': [
193
+ 'warn',
194
+ {
195
+ passive: false,
196
+ whitelist: writeGoodCommentsAllowlist
197
+ }
198
+ ]
199
+ },
200
+ settings: {
201
+ perfectionist: {
202
+ partitionByNewLine: true
203
+ }
204
+ }
205
+ }, {
206
+ extends: [eslintJson.configs.recommended],
207
+ files: ['**/*.json'],
208
+ ignores: ['**/package.json', '**/package-lock.json'],
209
+ language: 'json/json',
210
+ plugins: {
211
+ json: eslintJson
212
+ }
213
+ }, {
214
+ extends: [eslintMarkdown.configs.recommended],
215
+ files: ['**/*.md'],
216
+ language: 'markdown/gfm',
217
+ plugins: {
218
+ markdown: eslintMarkdown
219
+ }
220
+ });
221
+ export default config;
222
+ export { defineConfig } from 'eslint/config';
@@ -0,0 +1,262 @@
1
+ import eslintCspellRecommended from '@cspell/eslint-plugin/recommended'
2
+ import eslintPluginEslintComments from '@eslint-community/eslint-plugin-eslint-comments/configs'
3
+ import type { ConfigObject } from '@eslint/core'
4
+ import eslintJs from '@eslint/js'
5
+ import eslintJson from '@eslint/json'
6
+ import eslintMarkdown from '@eslint/markdown'
7
+ import eslintConfigLove from 'eslint-config-love'
8
+ import eslintPluginJsdoc from 'eslint-plugin-jsdoc'
9
+ import eslintPluginNoSecrets from 'eslint-plugin-no-secrets'
10
+ import eslintPluginPackageJson from 'eslint-plugin-package-json'
11
+ import eslintPluginPerfectionist from 'eslint-plugin-perfectionist'
12
+ import * as eslintPluginRegexp from 'eslint-plugin-regexp'
13
+ import eslintPluginSecurity from 'eslint-plugin-security'
14
+ import eslintPluginSonarJs from 'eslint-plugin-sonarjs'
15
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn'
16
+ import * as eslintPluginWriteGoodComments from 'eslint-plugin-write-good-comments'
17
+ import { defineConfig } from 'eslint/config'
18
+ import tseslint from 'typescript-eslint'
19
+
20
+ import cspellFlagWords from './lists/cspell.flagWords.js'
21
+ import cspellWords from './lists/cspell.words.js'
22
+ import noMagicNumbers from './lists/noMagicNumbers.ignore.js'
23
+ import writeGoodCommentsAllowlist from './lists/writeGoodComments.allowlist.js'
24
+
25
+ /**
26
+ * ESLint Configuration for General TypeScript/JavaScript Projects
27
+ */
28
+ export const config: ConfigObject[] = defineConfig(
29
+ {
30
+ linterOptions: {
31
+ reportUnusedDisableDirectives: 'error',
32
+ reportUnusedInlineConfigs: 'error'
33
+ }
34
+ },
35
+ eslintPluginPackageJson.configs.recommended,
36
+ {
37
+ extends: [
38
+ tseslint.configs.recommendedTypeChecked,
39
+ tseslint.configs.stylisticTypeChecked,
40
+
41
+ eslintJs.configs.recommended,
42
+
43
+ eslintCspellRecommended,
44
+ eslintPluginEslintComments.recommended,
45
+ eslintPluginJsdoc.configs['flat/recommended-typescript'],
46
+ eslintPluginPerfectionist.configs['recommended-natural'],
47
+ eslintPluginRegexp.configs['flat/recommended'],
48
+ eslintPluginSecurity.configs.recommended,
49
+ eslintPluginSonarJs.configs.recommended,
50
+ eslintPluginUnicorn.configs.recommended,
51
+ eslintConfigLove
52
+ ],
53
+ files: ['**/*.ts', '**/*.js'],
54
+ ignores: ['**/*.d.ts'],
55
+ languageOptions: {
56
+ parserOptions: {
57
+ ecmaFeatures: { modules: true },
58
+ ecmaVersion: 2022,
59
+ project: true,
60
+ sourceType: 'module'
61
+ }
62
+ },
63
+
64
+ plugins: {
65
+ 'no-secrets': eslintPluginNoSecrets,
66
+ // sonarjs: eslintPluginSonarJs,
67
+ // unicorn: eslintPluginUnicorn,
68
+ // woke: eslintPluginWoke,
69
+ 'write-good-comments': eslintPluginWriteGoodComments
70
+ },
71
+
72
+ rules: {
73
+ '@cspell/spellchecker': [
74
+ 'warn',
75
+ {
76
+ cspell: {
77
+ flagWords: cspellFlagWords,
78
+ language: 'en-CA,en-US,en-GB',
79
+ words: cspellWords
80
+ }
81
+ }
82
+ ],
83
+
84
+ '@typescript-eslint/init-declarations': 'warn',
85
+ '@typescript-eslint/no-magic-numbers': [
86
+ 'warn',
87
+ {
88
+ ignore: noMagicNumbers
89
+ }
90
+ ],
91
+ '@typescript-eslint/no-misused-promises': 'warn',
92
+ '@typescript-eslint/no-non-null-assertion': 'warn',
93
+ '@typescript-eslint/no-unnecessary-type-assertion': 'off',
94
+
95
+ '@typescript-eslint/no-unsafe-argument': 'warn',
96
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
97
+ '@typescript-eslint/no-unsafe-call': 'warn',
98
+ '@typescript-eslint/no-unsafe-member-access': 'warn',
99
+ '@typescript-eslint/no-unsafe-type-assertion': 'warn',
100
+
101
+ '@typescript-eslint/non-nullable-type-assertion-style': 'off',
102
+ '@typescript-eslint/prefer-destructuring': 'off',
103
+ '@typescript-eslint/restrict-plus-operands': 'warn',
104
+ '@typescript-eslint/space-before-function-paren': 'off',
105
+ '@typescript-eslint/strict-boolean-expressions': 'warn',
106
+
107
+ complexity: [
108
+ 'warn',
109
+ {
110
+ max: 20
111
+ }
112
+ ],
113
+
114
+ 'eslint-comments/require-description': 'off',
115
+
116
+ 'jsdoc/require-jsdoc': ['warn', { publicOnly: true }],
117
+
118
+ 'n/no-missing-import': 'off',
119
+
120
+ 'no-extra-semi': 'off',
121
+
122
+ 'no-param-reassign': ['error', { props: false }],
123
+
124
+ 'no-redeclare': 'off',
125
+ 'no-secrets/no-secrets': 'error',
126
+ 'no-undef': 'off',
127
+
128
+ // checked by "@typescript-eslint/no-unused-vars"
129
+ 'no-unused-vars': 'off',
130
+
131
+ 'perfectionist/sort-imports': [
132
+ 'error',
133
+ {
134
+ groups: [
135
+ 'builtin',
136
+ ['external', 'internal-type', 'internal', 'type'],
137
+ ['parent-type', 'parent'],
138
+ ['sibling-type', 'sibling'],
139
+ 'unknown'
140
+ ],
141
+ partitionByNewLine: false
142
+ }
143
+ ],
144
+ 'perfectionist/sort-interfaces': 'warn',
145
+ 'perfectionist/sort-modules': 'warn',
146
+ 'perfectionist/sort-named-exports': [
147
+ 'error',
148
+ {
149
+ groupKind: 'types-first'
150
+ }
151
+ ],
152
+ 'perfectionist/sort-named-imports': [
153
+ 'error',
154
+ {
155
+ groupKind: 'types-first'
156
+ }
157
+ ],
158
+ 'perfectionist/sort-object-types': 'warn',
159
+ 'perfectionist/sort-objects': 'warn',
160
+
161
+ 'perfectionist/sort-union-types': [
162
+ 'error',
163
+ {
164
+ groups: ['unknown', 'nullish']
165
+ }
166
+ ],
167
+
168
+ // checked by "no-useless-escape"
169
+ 'regexp/no-useless-escape': 'off',
170
+
171
+ // checked by "complexity"
172
+ 'sonarjs/cognitive-complexity': 'off',
173
+
174
+ 'sonarjs/different-types-comparison': 'off',
175
+
176
+ // checked by "regexp/no-dupe-characters-character-class"
177
+ 'sonarjs/duplicates-in-character-class': 'off',
178
+
179
+ 'sonarjs/no-duplicate-string': 'warn',
180
+
181
+ // checked by "@typescript-eslint/no-misused-promises"
182
+ 'sonarjs/no-misused-promises': 'off',
183
+
184
+ // checked by "@typescript-eslint/no-redundant-type-constituents"
185
+ 'sonarjs/no-redundant-type-constituents': 'off',
186
+
187
+ 'sonarjs/unnecessary-character-escapes': 'off',
188
+
189
+ 'unicorn/consistent-function-scoping': 'warn',
190
+ 'unicorn/empty-brace-spaces': 'off',
191
+ 'unicorn/filename-case': [
192
+ 'error',
193
+ {
194
+ case: 'camelCase',
195
+ ignore: ['DB', 'URL']
196
+ }
197
+ ],
198
+ 'unicorn/prevent-abbreviations': [
199
+ 'error',
200
+ {
201
+ replacements: {
202
+ def: {
203
+ definition: true
204
+ },
205
+ ele: {
206
+ element: true
207
+ },
208
+ eles: {
209
+ elements: true
210
+ },
211
+ fns: {
212
+ functions: true
213
+ },
214
+ res: {
215
+ result: false
216
+ },
217
+ temp: {
218
+ temporary: false
219
+ }
220
+ }
221
+ }
222
+ ],
223
+
224
+ // 'woke/all': 'error',
225
+
226
+ 'write-good-comments/write-good-comments': [
227
+ 'warn',
228
+ {
229
+ passive: false,
230
+ whitelist: writeGoodCommentsAllowlist
231
+ }
232
+ ]
233
+ },
234
+ settings: {
235
+ perfectionist: {
236
+ partitionByNewLine: true
237
+ }
238
+ }
239
+ },
240
+ {
241
+ extends: [eslintJson.configs.recommended],
242
+ files: ['**/*.json'],
243
+ ignores: ['**/package.json', '**/package-lock.json'],
244
+ language: 'json/json',
245
+ plugins: {
246
+ json: eslintJson
247
+ }
248
+ },
249
+ {
250
+ extends: [eslintMarkdown.configs.recommended],
251
+ files: ['**/*.md'],
252
+ language: 'markdown/gfm',
253
+ plugins: {
254
+ markdown: eslintMarkdown
255
+ }
256
+ }
257
+ )
258
+
259
+ export default config
260
+
261
+ export type { ConfigObject } from '@eslint/core'
262
+ export { defineConfig } from 'eslint/config'
package/exports.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { default as cspellFlagWords } from './lists/cspell.flagWords.js';
2
+ export { default as cspellWords } from './lists/cspell.words.js';
3
+ export { httpStatusCodes as noMagicNumbersHttpStatusCodes, default as noMagicNumbersIgnore } from './lists/noMagicNumbers.ignore.js';
4
+ export { default as writeGoodCommentsAllowlist } from './lists/writeGoodComments.allowlist.js';
package/exports.js ADDED
@@ -0,0 +1,4 @@
1
+ export { default as cspellFlagWords } from './lists/cspell.flagWords.js';
2
+ export { default as cspellWords } from './lists/cspell.words.js';
3
+ export { httpStatusCodes as noMagicNumbersHttpStatusCodes, default as noMagicNumbersIgnore } from './lists/noMagicNumbers.ignore.js';
4
+ export { default as writeGoodCommentsAllowlist } from './lists/writeGoodComments.allowlist.js';
package/exports.ts ADDED
@@ -0,0 +1,9 @@
1
+ export { default as cspellFlagWords } from './lists/cspell.flagWords.js'
2
+ export { default as cspellWords } from './lists/cspell.words.js'
3
+
4
+ export {
5
+ httpStatusCodes as noMagicNumbersHttpStatusCodes,
6
+ default as noMagicNumbersIgnore
7
+ } from './lists/noMagicNumbers.ignore.js'
8
+
9
+ export { default as writeGoodCommentsAllowlist } from './lists/writeGoodComments.allowlist.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-cityssm",
3
- "version": "32.3.2",
3
+ "version": "33.0.0",
4
4
  "description": "ESLint rules used in the City of Sault Ste. Marie's TypeScript projects.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -39,7 +39,11 @@
39
39
  "type": "module",
40
40
  "exports": {
41
41
  ".": "./eslint.config.js",
42
- "./eslint.config.js": "./eslint.config.js"
42
+ "./packageConfig": "./eslint.packageConfig.js",
43
+ "./eslint.packageConfig.js": "./eslint.packageConfig.js",
44
+ "./eslint.config.js": "./eslint.config.js",
45
+ "./exports": "./exports.js",
46
+ "./exports.js": "./exports.js"
43
47
  },
44
48
  "main": "eslint.config.js",
45
49
  "scripts": {
@@ -57,8 +61,8 @@
57
61
  "@html-eslint/eslint-plugin": "^0.47.0",
58
62
  "@html-eslint/parser": "^0.47.0",
59
63
  "eslint": "9.37.0",
60
- "eslint-config-love": "^130.0.0",
61
- "eslint-plugin-jsdoc": "^61.0.0",
64
+ "eslint-config-love": "^133.0.0",
65
+ "eslint-plugin-jsdoc": "^61.0.1",
62
66
  "eslint-plugin-n": "^17.23.1",
63
67
  "eslint-plugin-no-secrets": "^2.2.1",
64
68
  "eslint-plugin-no-unsanitized": "^4.1.4",