@aryaemami59/eslint-config 0.0.6 → 0.0.8

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/src/index.ts CHANGED
@@ -1,20 +1,24 @@
1
1
  export { disabledRules } from './disabledRules.js'
2
2
  export {
3
- config,
4
- configs,
3
+ defineConfig,
5
4
  js,
6
- parser,
7
- plugin,
8
5
  prettierConfig,
6
+ tseslintConfig,
7
+ tseslintConfigs,
8
+ tseslintParser,
9
+ tseslintPlugin,
9
10
  } from './external.js'
10
11
  export type {
11
12
  Config,
12
- ConfigArray,
13
- ConfigWithExtends,
14
- FlatConfig,
15
- InfiniteDepthConfigWithExtends,
13
+ ESLint,
14
+ Linter,
15
+ TSESLintConfig,
16
+ TSESLintConfigArray,
17
+ TSESLintConfigWithExtends,
18
+ TSESLintFlatConfig,
19
+ TSESLintInfiniteDepthConfigWithExtends,
16
20
  } from './external.js'
17
21
  export { globalIgnores } from './globalIgnores.js'
18
- export { globals, vitestGlobals } from './globals.js'
22
+ export { sharedEnvironmentGlobals, vitestGlobals } from './globals.js'
19
23
  export { flatESLintConfig } from './shareableConfigs.js'
20
24
  export { createESLintConfig } from './utils.js'
@@ -1,4 +1,4 @@
1
- import packageJson from '../package.json' with { type: 'json' }
1
+ import packageJson from '@aryaemami59/eslint-config/package.json' with { type: 'json' }
2
2
 
3
3
  /**
4
4
  * This is used because if we import the package name from the
@@ -1,10 +1,15 @@
1
- import type { Linter } from 'eslint'
1
+ import packageJson from '@aryaemami59/eslint-config/package.json' with { type: 'json' }
2
2
  import { disabledRules } from './disabledRules.js'
3
- import type { FlatConfig } from './external.js'
4
- import { js, prettierConfig } from './external.js'
3
+ import type { Config, ESLint, Linter, TSESLintFlatConfig } from './external.js'
4
+ import {
5
+ js,
6
+ prettierConfig,
7
+ tseslintConfigs,
8
+ tseslintParser,
9
+ tseslintPlugin,
10
+ } from './external.js'
5
11
  import { globalIgnores } from './globalIgnores.js'
6
- import { globals } from './globals.js'
7
- import { packageJsonName } from './packageJsonName.js'
12
+ import { sharedEnvironmentGlobals } from './globals.js'
8
13
 
9
14
  /**
10
15
  * Flat ESLint configuration tailored for projects using TypeScript.
@@ -56,155 +61,161 @@ export const flatESLintConfig = [
56
61
  {
57
62
  name: `${js.meta.name}/recommended`,
58
63
  ...js.configs.recommended,
59
- } as const satisfies FlatConfig.Config satisfies Linter.Config,
64
+ } as const satisfies TSESLintFlatConfig.Config satisfies Config,
60
65
 
61
66
  // TODO: You can remove the type assertion in the next major version of `typescript-eslint`.
62
67
  // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
63
- // ...(configs.recommended satisfies Linter.Config[] as Linter.Config<any>[]),
68
+ ...(tseslintConfigs.recommended satisfies TSESLintFlatConfig.Config[] satisfies Config[] as Config[]),
64
69
  // TODO: You can remove the type assertion in the next major version of `typescript-eslint`.
65
70
  // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
66
- // ...(configs.stylistic satisfies Linter.Config[] as Linter.Config<any>[]),
71
+ ...(tseslintConfigs.stylistic satisfies TSESLintFlatConfig.Config[] satisfies Config[] as Config[]),
67
72
 
68
73
  {
69
74
  languageOptions: {
70
- globals,
75
+ globals: sharedEnvironmentGlobals,
76
+ parser:
77
+ tseslintParser satisfies TSESLintFlatConfig.Parser satisfies Linter.Parser as Linter.Parser,
71
78
  parserOptions: {
72
79
  ecmaVersion: 'latest',
73
80
  projectService: true,
74
- } as const satisfies FlatConfig.ParserOptions satisfies Linter.ParserOptions,
75
- },
81
+ } as const satisfies TSESLintFlatConfig.ParserOptions satisfies Linter.ParserOptions,
82
+ } as const satisfies TSESLintFlatConfig.LanguageOptions satisfies Linter.LanguageOptions,
76
83
  linterOptions: {
77
84
  reportUnusedDisableDirectives: 2,
78
85
  reportUnusedInlineConfigs: 2,
79
86
  },
80
- name: `${packageJsonName}/defaults/overrides`,
87
+ name: `${packageJson.name}/defaults/overrides`,
88
+ plugins: {
89
+ '@typescript-eslint':
90
+ tseslintPlugin satisfies TSESLintFlatConfig.Plugin satisfies ESLint.Plugin as ESLint.Plugin,
91
+ },
81
92
 
82
93
  rules: {
83
94
  // TODO: Uncomment this once https://github.com/typescript-eslint/typescript-eslint/issues/11952 is resolved.
84
- // '@typescript-eslint/consistent-type-definitions': [2, 'type'],
85
- // '@typescript-eslint/consistent-type-exports': [
86
- // 2,
87
- // { fixMixedExportsWithInlineTypeSpecifier: false },
88
- // ],
89
- // '@typescript-eslint/consistent-type-imports': [
90
- // 2,
91
- // {
92
- // disallowTypeAnnotations: true,
93
- // fixStyle: 'separate-type-imports',
94
- // prefer: 'type-imports',
95
- // },
96
- // ],
97
- // '@typescript-eslint/no-confusing-void-expression': [
98
- // 2,
99
- // {
100
- // ignoreArrowShorthand: false,
101
- // ignoreVoidOperator: false,
102
- // ignoreVoidReturningFunctions: false,
103
- // },
104
- // ],
105
- // '@typescript-eslint/no-duplicate-type-constituents': [
106
- // 2,
107
- // {
108
- // ignoreIntersections: false,
109
- // ignoreUnions: false,
110
- // },
111
- // ],
112
- // '@typescript-eslint/no-empty-object-type': [
113
- // 2,
114
- // {
115
- // allowInterfaces: 'never',
116
- // allowObjectTypes: 'never',
117
- // },
118
- // ],
119
- // '@typescript-eslint/no-explicit-any': [
120
- // 2,
121
- // {
122
- // fixToUnknown: false,
123
- // ignoreRestArgs: false,
124
- // },
125
- // ],
126
- // '@typescript-eslint/no-inferrable-types': [
127
- // 2,
128
- // {
129
- // ignoreParameters: false,
130
- // ignoreProperties: false,
131
- // },
132
- // ],
133
- // '@typescript-eslint/no-invalid-void-type': [
134
- // 2,
135
- // {
136
- // allowAsThisParameter: false,
137
- // allowInGenericTypeArguments: true,
138
- // },
139
- // ],
140
- // '@typescript-eslint/no-namespace': [
141
- // 2,
142
- // {
143
- // allowDeclarations: false,
144
- // allowDefinitionFiles: true,
145
- // },
146
- // ],
147
- // '@typescript-eslint/no-redundant-type-constituents': [2],
148
- // '@typescript-eslint/no-require-imports': [
149
- // 2,
150
- // {
151
- // allow: [],
152
- // allowAsImport: true,
153
- // },
154
- // ],
155
- // '@typescript-eslint/no-restricted-types': [
156
- // 2,
157
- // {
158
- // types: {
159
- // '{}': {
160
- // message: `
161
- // - If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
162
- // - If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
163
- // - If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
164
- // suggest: [
165
- // 'AnyNonNullishValue',
166
- // 'EmptyObject',
167
- // 'AnyObject',
168
- // 'object',
169
- // 'Record<string, never>',
170
- // 'Record<string, any>',
171
- // 'NonNullable<unknown>',
172
- // ],
173
- // },
174
- // },
175
- // },
176
- // ],
177
- // '@typescript-eslint/no-unnecessary-type-arguments': [2],
178
- // '@typescript-eslint/no-unnecessary-type-assertion': [
179
- // 2,
180
- // { typesToIgnore: [] },
181
- // ],
182
- // '@typescript-eslint/no-unnecessary-type-parameters': [2],
183
- // '@typescript-eslint/prefer-nullish-coalescing': [
184
- // 2,
185
- // {
186
- // allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
187
- // ignoreBooleanCoercion: false,
188
- // ignoreConditionalTests: true,
189
- // ignoreIfStatements: false,
190
- // ignoreMixedLogicalExpressions: false,
191
- // ignorePrimitives: {
192
- // bigint: false,
193
- // boolean: false,
194
- // number: false,
195
- // string: false,
196
- // },
197
- // ignoreTernaryTests: false,
198
- // },
199
- // ],
200
- // '@typescript-eslint/require-await': [2],
201
- // '@typescript-eslint/unified-signatures': [
202
- // 2,
203
- // {
204
- // ignoreDifferentlyNamedParameters: false,
205
- // ignoreOverloadsWithDifferentJSDoc: false,
206
- // },
207
- // ],
95
+ '@typescript-eslint/consistent-type-definitions': [2, 'type'],
96
+ '@typescript-eslint/consistent-type-exports': [
97
+ 2,
98
+ { fixMixedExportsWithInlineTypeSpecifier: false },
99
+ ],
100
+ '@typescript-eslint/consistent-type-imports': [
101
+ 2,
102
+ {
103
+ disallowTypeAnnotations: true,
104
+ fixStyle: 'separate-type-imports',
105
+ prefer: 'type-imports',
106
+ },
107
+ ],
108
+ '@typescript-eslint/no-confusing-void-expression': [
109
+ 2,
110
+ {
111
+ ignoreArrowShorthand: false,
112
+ ignoreVoidOperator: false,
113
+ ignoreVoidReturningFunctions: false,
114
+ },
115
+ ],
116
+ '@typescript-eslint/no-duplicate-type-constituents': [
117
+ 2,
118
+ {
119
+ ignoreIntersections: false,
120
+ ignoreUnions: false,
121
+ },
122
+ ],
123
+ '@typescript-eslint/no-empty-object-type': [
124
+ 2,
125
+ {
126
+ allowInterfaces: 'never',
127
+ allowObjectTypes: 'never',
128
+ },
129
+ ],
130
+ '@typescript-eslint/no-explicit-any': [
131
+ 2,
132
+ {
133
+ fixToUnknown: false,
134
+ ignoreRestArgs: false,
135
+ },
136
+ ],
137
+ '@typescript-eslint/no-inferrable-types': [
138
+ 2,
139
+ {
140
+ ignoreParameters: false,
141
+ ignoreProperties: false,
142
+ },
143
+ ],
144
+ '@typescript-eslint/no-invalid-void-type': [
145
+ 2,
146
+ {
147
+ allowAsThisParameter: false,
148
+ allowInGenericTypeArguments: true,
149
+ },
150
+ ],
151
+ '@typescript-eslint/no-namespace': [
152
+ 2,
153
+ {
154
+ allowDeclarations: false,
155
+ allowDefinitionFiles: true,
156
+ },
157
+ ],
158
+ '@typescript-eslint/no-redundant-type-constituents': [2],
159
+ '@typescript-eslint/no-require-imports': [
160
+ 2,
161
+ {
162
+ allow: [],
163
+ allowAsImport: true,
164
+ },
165
+ ],
166
+ '@typescript-eslint/no-restricted-types': [
167
+ 2,
168
+ {
169
+ types: {
170
+ '{}': {
171
+ message: `
172
+ - If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
173
+ - If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
174
+ - If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
175
+ suggest: [
176
+ 'AnyNonNullishValue',
177
+ 'EmptyObject',
178
+ 'AnyObject',
179
+ 'object',
180
+ 'Record<string, never>',
181
+ 'Record<string, any>',
182
+ 'NonNullable<unknown>',
183
+ ],
184
+ },
185
+ },
186
+ },
187
+ ],
188
+ '@typescript-eslint/no-unnecessary-type-arguments': [2],
189
+ '@typescript-eslint/no-unnecessary-type-assertion': [
190
+ 2,
191
+ { typesToIgnore: [] },
192
+ ],
193
+ '@typescript-eslint/no-unnecessary-type-parameters': [2],
194
+ '@typescript-eslint/prefer-nullish-coalescing': [
195
+ 2,
196
+ {
197
+ allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
198
+ ignoreBooleanCoercion: false,
199
+ ignoreConditionalTests: true,
200
+ ignoreIfStatements: false,
201
+ ignoreMixedLogicalExpressions: false,
202
+ ignorePrimitives: {
203
+ bigint: false,
204
+ boolean: false,
205
+ number: false,
206
+ string: false,
207
+ },
208
+ ignoreTernaryTests: false,
209
+ },
210
+ ],
211
+ '@typescript-eslint/require-await': [2],
212
+ '@typescript-eslint/unified-signatures': [
213
+ 2,
214
+ {
215
+ ignoreDifferentlyNamedParameters: false,
216
+ ignoreOverloadsWithDifferentJSDoc: false,
217
+ },
218
+ ],
208
219
  'object-shorthand': [
209
220
  2,
210
221
  'always',
@@ -228,14 +239,14 @@ export const flatESLintConfig = [
228
239
 
229
240
  ...disabledRules,
230
241
  },
231
- } as const satisfies Linter.Config,
242
+ } as const satisfies Config,
232
243
 
233
244
  {
234
245
  files: ['**/*.cjs'],
235
246
  languageOptions: {
236
247
  sourceType: 'commonjs',
237
- } as const satisfies FlatConfig.LanguageOptions satisfies Linter.LanguageOptions,
238
- name: `${packageJsonName}/commonjs-files`,
248
+ } as const satisfies TSESLintFlatConfig.LanguageOptions satisfies Linter.LanguageOptions,
249
+ name: `${packageJson.name}/commonjs-files`,
239
250
  rules: {
240
251
  '@typescript-eslint/no-require-imports': [
241
252
  0,
@@ -245,7 +256,7 @@ export const flatESLintConfig = [
245
256
  },
246
257
  ],
247
258
  },
248
- } as const satisfies Linter.Config,
259
+ } as const satisfies Config,
249
260
 
250
261
  prettierConfig,
251
- ] as const satisfies Linter.Config[]
262
+ ] as const satisfies Config[]
package/src/utils.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Linter } from 'eslint'
2
- import { defineConfig } from 'eslint/config'
1
+ import type { Config } from './external.js'
2
+ import { defineConfig } from './external.js'
3
3
  import { flatESLintConfig } from './shareableConfigs.js'
4
4
 
5
5
  /**
@@ -88,5 +88,5 @@ import { flatESLintConfig } from './shareableConfigs.js'
88
88
  */
89
89
  export const createESLintConfig = (
90
90
  additionalOverrides: Parameters<typeof defineConfig> = [],
91
- ): Linter.Config[] =>
91
+ ): Config[] =>
92
92
  /* @__PURE__ */ defineConfig(...flatESLintConfig, ...additionalOverrides)