-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eslint flat config & react 19 migration
- Loading branch information
Showing
19 changed files
with
1,438 additions
and
1,392 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1 @@ | ||
20 | ||
22 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
export const importConfig = [ | ||
{ | ||
rules: { | ||
'import/first': 'warn', | ||
'import/newline-after-import': 'warn', | ||
'import/no-duplicates': 'warn', | ||
}, | ||
}, | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import js from '@eslint/js'; | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
export const javascriptConfig = [ | ||
js.configs.recommended, | ||
{ | ||
rules: { | ||
'no-console': 'warn', | ||
'no-alert': 'warn', | ||
'object-shorthand': 'warn', | ||
eqeqeq: 'warn', | ||
'no-param-reassign': 'warn', | ||
'prefer-template': 'warn', | ||
'no-nested-ternary': 'warn', | ||
'no-else-return': 'warn', | ||
}, | ||
}, | ||
]; |
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,12 @@ | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: import.meta.dirname, | ||
}); | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
export const nextConfig = [ | ||
...compat.config({ | ||
extends: ['next/core-web-vitals', 'next/typescript'], | ||
}), | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
export const prettierConfig = [ | ||
eslintConfigPrettier, | ||
{ | ||
rules: { | ||
curly: ['warn', 'multi-line'], | ||
}, | ||
}, | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import tseslint from 'typescript-eslint'; | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
export const typescriptConfig = [ | ||
...tseslint.configs.strictTypeChecked, | ||
// https://typescript-eslint.io/getting-started/typed-linting/ | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}, | ||
{ | ||
rules: { | ||
'@typescript-eslint/prefer-destructuring': 'warn', | ||
'@typescript-eslint/consistent-type-imports': 'warn', | ||
'@typescript-eslint/no-misused-promises': [ | ||
'warn', | ||
{ checksVoidReturn: false }, | ||
], | ||
'@typescript-eslint/restrict-template-expressions': [ | ||
'warn', | ||
{ allowNumber: true }, | ||
], | ||
}, | ||
}, | ||
// https://typescript-eslint.io/getting-started/typed-linting/#how-can-i-disable-type-aware-linting-for-a-subset-of-files | ||
{ | ||
files: ['**/*.{js,mjs}'], | ||
...tseslint.configs.disableTypeChecked, | ||
}, | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import eslintPluginUnicorn from 'eslint-plugin-unicorn'; | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
export const unicornConfig = [ | ||
eslintPluginUnicorn.configs['flat/recommended'], | ||
// https://github.com/sindresorhus/eslint-plugin-unicorn/tree/main?tab=readme-ov-file#rules | ||
{ | ||
rules: { | ||
'unicorn/prevent-abbreviations': 'off', | ||
'unicorn/no-null': 'off', | ||
'unicorn/prefer-module': 'off', | ||
'unicorn/explicit-length-check': 'off', | ||
'unicorn/prefer-ternary': 'off', | ||
'unicorn/no-array-for-each': 'off', | ||
'unicorn/prefer-export-from': 'off', | ||
}, | ||
}, | ||
]; |
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,28 @@ | ||
import onlyWarn from 'eslint-plugin-only-warn'; | ||
import { importConfig } from './config/eslint/import.mjs'; | ||
import { javascriptConfig } from './config/eslint/javascript.mjs'; | ||
import { nextConfig } from './config/eslint/next.mjs'; | ||
import { prettierConfig } from './config/eslint/prettier.mjs'; | ||
import { typescriptConfig } from './config/eslint/typescript.mjs'; | ||
import { unicornConfig } from './config/eslint/unicorn.mjs'; | ||
|
||
// https://nextjs.org/docs/app/api-reference/config/eslint#additional-configurations | ||
/** @type {import("eslint").Linter.Config} */ | ||
const config = [ | ||
...javascriptConfig, | ||
...typescriptConfig, | ||
...importConfig, | ||
...unicornConfig, | ||
...prettierConfig, | ||
{ | ||
plugins: { | ||
onlyWarn, | ||
}, | ||
}, | ||
{ | ||
ignores: ['src/core/gql'], | ||
}, | ||
...nextConfig, | ||
]; | ||
|
||
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
Oops, something went wrong.