-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #506 from Debbl/feat/eslint
feat: support eslint flat config
- Loading branch information
Showing
11 changed files
with
952 additions
and
264 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,85 @@ | ||
import typescript from '@typescript-eslint/eslint-plugin' | ||
import js from '@eslint/js' | ||
import nextPlugin from '@next/eslint-plugin-next' | ||
import reactPlugin from 'eslint-plugin-react' | ||
import reactHooksPlugin from 'eslint-plugin-react-hooks' | ||
import parserTypescript from '@typescript-eslint/parser' | ||
import globals from 'globals' | ||
import configPrettier from 'eslint-config-prettier' | ||
|
||
/** | ||
* @type {import('eslint').Linter.Config[]} | ||
*/ | ||
const config = [ | ||
{ | ||
ignores: ['**/node_modules', 'pnpm-lock.yaml', '**/bin', '**/workspace'], | ||
}, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 2022, | ||
globals: { | ||
...globals.browser, | ||
...globals.es2021, | ||
...globals.node, | ||
document: 'readonly', | ||
navigator: 'readonly', | ||
window: 'readonly', | ||
}, | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
}, | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
...js.configs.recommended.rules, | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
args: 'none', | ||
caughtErrors: 'none', | ||
ignoreRestSiblings: true, | ||
vars: 'all', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
plugins: { | ||
react: reactPlugin, | ||
'react-hooks': reactHooksPlugin, | ||
'@next/next': nextPlugin, | ||
}, | ||
rules: { | ||
...reactPlugin.configs['jsx-runtime'].rules, | ||
...reactHooksPlugin.configs.recommended.rules, | ||
...nextPlugin.configs.recommended.rules, | ||
...nextPlugin.configs['core-web-vitals'].rules, | ||
'@next/next/no-img-element': 'error', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
plugins: { | ||
'@typescript-eslint': typescript, | ||
}, | ||
languageOptions: { | ||
parser: parserTypescript, | ||
}, | ||
rules: { | ||
...typescript.configs.recommended.rules, | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@next/next/no-html-link-for-pages': 'off', | ||
}, | ||
}, | ||
{ | ||
...configPrettier, | ||
}, | ||
] | ||
|
||
export default config |
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
Oops, something went wrong.