Skip to content

Commit fc82e84

Browse files
committed
chore: Using JSDoc annotations instead of the defineConfig method
1 parent b008b3c commit fc82e84

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

packages/eslint-config-basic/index.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
const { defineConfig } = require('eslint-define-config')
2-
3-
module.exports = defineConfig({
1+
/** @type {import('eslint-define-config').ESLintConfig} */
2+
module.exports = {
43
env: {
54
es6: true,
65
browser: true,
@@ -195,7 +194,23 @@ module.exports = defineConfig({
195194
],
196195
rules: {
197196
// import
198-
'import/order': 'error',
197+
'import/order': [
198+
'error',
199+
{
200+
groups: [
201+
'builtin',
202+
'external',
203+
'internal',
204+
'parent',
205+
'sibling',
206+
'index',
207+
'object',
208+
'type',
209+
],
210+
pathGroups: [{ pattern: '@/**', group: 'internal' }],
211+
pathGroupsExcludedImportTypes: ['type'],
212+
},
213+
],
199214
'import/first': 'error',
200215
'import/no-mutable-exports': 'error',
201216
'import/no-unresolved': 'off',
@@ -378,4 +393,4 @@ module.exports = defineConfig({
378393
'coderwyd/top-level-function': 'error',
379394
// 'coderwyd/prefer-inline-type-import': 'error',
380395
},
381-
})
396+
}

packages/eslint-config-basic/standard.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Inline from https://github.com/standard/eslint-config-standard/blob/master/.eslintrc.json
22
// Until it upgrades
33

4-
const { defineConfig } = require('eslint-define-config')
5-
6-
module.exports = defineConfig({
4+
module.exports = {
75
parserOptions: {
86
ecmaVersion: 2022,
97
ecmaFeatures: {
@@ -246,4 +244,4 @@ module.exports = defineConfig({
246244

247245
'promise/param-names': 'error',
248246
},
249-
})
247+
}

packages/eslint-config-react/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
const { defineConfig } = require('eslint-define-config')
2-
3-
module.exports = defineConfig({
1+
/** @type {import('eslint-define-config').ESLintConfig} */
2+
module.exports = {
43
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended', '@coderwyd/eslint-config-ts'],
54
settings: {
65
react: {
@@ -11,4 +10,4 @@ module.exports = defineConfig({
1110
'jsx-quotes': ['error', 'prefer-double'],
1211
'react/react-in-jsx-scope': 'off',
1312
},
14-
})
13+
}

packages/eslint-config-ts/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
const fs = require('node:fs')
22
const { join } = require('node:path')
33
const process = require('node:process')
4-
const { defineConfig } = require('eslint-define-config')
54
const basic = require('@coderwyd/eslint-config-basic')
65

76
const tsconfig = process.env.ESLINT_TSCONFIG || 'tsconfig.eslint.json'
87

9-
module.exports = defineConfig({
8+
/** @type {import('eslint-define-config').ESLintConfig} */
9+
module.exports = {
1010
extends: ['@coderwyd/eslint-config-basic', 'plugin:import/typescript', 'plugin:@typescript-eslint/recommended'],
1111
settings: {
1212
'import/resolver': {
@@ -184,4 +184,4 @@ module.exports = defineConfig({
184184
// handled by unused-imports/no-unused-imports
185185
'@typescript-eslint/no-unused-vars': 'off',
186186
},
187-
})
187+
}

packages/eslint-config-vue/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
const { defineConfig } = require('eslint-define-config')
21
const { isPackageExists } = require('local-pkg')
32

43
const TS = isPackageExists('typescript')
54

65
if (!TS)
76
console.warn('[@coderwyd/eslint-config] TypeScript is not installed, fallback to JS only.')
87

9-
module.exports = defineConfig({
8+
/** @type {import('eslint-define-config').ESLintConfig} */
9+
module.exports = {
1010
overrides: [
1111
{
1212
files: ['*.vue'],
@@ -110,4 +110,4 @@ module.exports = defineConfig({
110110
'vue/space-unary-ops': ['error', { words: true, nonwords: false }],
111111
'vue/template-curly-spacing': 'error',
112112
},
113-
})
113+
}

0 commit comments

Comments
 (0)