-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import babelParser from '@babel/eslint-parser' | ||
import js from '@eslint/js' | ||
import sort from 'eslint-plugin-sort' | ||
import widen from 'eslint-plugin-widen' | ||
import globals from 'globals' | ||
|
||
export default [ | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.es6, | ||
...globals.jest, | ||
...globals.node, | ||
}, | ||
parser: babelParser, | ||
parserOptions: { | ||
requireConfigFile: false, | ||
}, | ||
}, | ||
plugins: { | ||
sort, | ||
widen, | ||
}, | ||
rules: { | ||
'default-param-last': 'error', | ||
'dot-notation': 'error', | ||
eqeqeq: [ | ||
'error', | ||
'always', | ||
{ | ||
null: 'ignore', | ||
}, | ||
], | ||
'no-console': ['error', { allow: ['error'] }], | ||
'no-dupe-args': 'error', | ||
'no-duplicate-imports': 'error', | ||
'no-else-return': 'error', | ||
'no-empty': ['error', { allowEmptyCatch: true }], | ||
'no-extra-bind': 'error', | ||
'no-param-reassign': 'error', | ||
'no-return-await': 'error', | ||
'no-template-curly-in-string': 'error', | ||
'no-unneeded-ternary': 'error', | ||
'no-unused-expressions': 'off', | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
ignoreRestSiblings: true, | ||
varsIgnorePattern: '^_', | ||
}, | ||
], | ||
'no-useless-computed-key': 'error', | ||
'no-var': 'error', | ||
'object-shorthand': 'error', | ||
'prefer-const': [ | ||
'error', | ||
{ | ||
destructuring: 'all', | ||
}, | ||
], | ||
'require-await': 'error', | ||
'sort/exports': [ | ||
'warn', | ||
{ | ||
groups: [ | ||
{ order: 6, type: 'default' }, | ||
{ order: 5, type: 'sourceless' }, | ||
{ order: 2, regex: '^@widen\\/' }, | ||
{ order: 4, regex: '^\\.+' }, | ||
{ order: 1, type: 'dependency' }, | ||
{ order: 3, type: 'other' }, | ||
], | ||
}, | ||
], | ||
'sort/imports': [ | ||
'warn', | ||
{ | ||
groups: [ | ||
{ order: 1, type: 'side-effect' }, | ||
{ order: 3, regex: '^@widen\\/' }, | ||
{ order: 5, regex: '^\\.+' }, | ||
{ order: 2, type: 'dependency' }, | ||
{ order: 4, type: 'other' }, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
js.configs.recommended, | ||
{ | ||
files: ['**/*.js', '**/*.mjs'], | ||
rules: { | ||
'prettier/prettier': 'error', // Assuming you have `eslint-plugin-prettier` setup | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,25 @@ | ||
import babelParser from '@babel/eslint-parser' | ||
import js from '@eslint/js' | ||
import sort from 'eslint-plugin-sort' | ||
import widen from 'eslint-plugin-widen' | ||
import globals from 'globals' | ||
// index.js or index.mjs inside eslint-config-widen package | ||
import baseConfig from './index.js' | ||
import typescriptConfig from './typescript.js' | ||
import reactConfig from './react.js' | ||
import playwrightConfig from './playwright.js' | ||
import jestConfig from './jest.js' | ||
import { Linter } from 'eslint' | ||
|
||
export default [ | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.es6, | ||
...globals.jest, | ||
...globals.node, | ||
}, | ||
parser: babelParser, | ||
parserOptions: { | ||
requireConfigFile: false, | ||
}, | ||
}, | ||
plugins: { | ||
sort, | ||
widen, | ||
}, | ||
rules: { | ||
'default-param-last': 'error', | ||
'dot-notation': 'error', | ||
eqeqeq: [ | ||
'error', | ||
'always', | ||
{ | ||
null: 'ignore', | ||
}, | ||
], | ||
'no-console': ['error', { allow: ['error'] }], | ||
'no-dupe-args': 'error', | ||
'no-duplicate-imports': 'error', | ||
'no-else-return': 'error', | ||
'no-empty': ['error', { allowEmptyCatch: true }], | ||
'no-extra-bind': 'error', | ||
'no-param-reassign': 'error', | ||
'no-return-await': 'error', | ||
'no-template-curly-in-string': 'error', | ||
'no-unneeded-ternary': 'error', | ||
'no-unused-expressions': 'off', | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
ignoreRestSiblings: true, | ||
varsIgnorePattern: '^_', | ||
}, | ||
], | ||
'no-useless-computed-key': 'error', | ||
'no-var': 'error', | ||
'object-shorthand': 'error', | ||
'prefer-const': [ | ||
'error', | ||
{ | ||
destructuring: 'all', | ||
}, | ||
], | ||
'require-await': 'error', | ||
'sort/exports': [ | ||
'warn', | ||
{ | ||
groups: [ | ||
{ order: 6, type: 'default' }, | ||
{ order: 5, type: 'sourceless' }, | ||
{ order: 2, regex: '^@widen\\/' }, | ||
{ order: 4, regex: '^\\.+' }, | ||
{ order: 1, type: 'dependency' }, | ||
{ order: 3, type: 'other' }, | ||
], | ||
}, | ||
], | ||
'sort/imports': [ | ||
'warn', | ||
{ | ||
groups: [ | ||
{ order: 1, type: 'side-effect' }, | ||
{ order: 3, regex: '^@widen\\/' }, | ||
{ order: 5, regex: '^\\.+' }, | ||
{ order: 2, type: 'dependency' }, | ||
{ order: 4, type: 'other' }, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
js.configs.recommended, | ||
{ | ||
files: ['**/*.js', '**/*.mjs'], | ||
rules: { | ||
'prettier/prettier': 'error', // Assuming you have `eslint-plugin-prettier` setup | ||
}, | ||
}, | ||
] | ||
export interface EslintConfig { | ||
base: Linter.FlatConfig[] | ||
typescript: Linter.FlatConfig[] | ||
react: Linter.FlatConfig[] | ||
playwright: Linter.FlatConfig[] | ||
jest: Linter.FlatConfig[] | ||
} | ||
|
||
const configs = { | ||
base: baseConfig, | ||
typescript: typescriptConfig, | ||
react: reactConfig, | ||
playwright: playwrightConfig, | ||
jest: jestConfig, | ||
} as unknown as EslintConfig | ||
|
||
export default configs |