-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update eslint ver * fix: use new type * migrate into eslint v9 config * chore: changeset
- Loading branch information
1 parent
50c2212
commit d4a9273
Showing
18 changed files
with
376 additions
and
323 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@virtual-live-lab/eslint-config": minor | ||
--- | ||
|
||
update to eslint v9, typescript-eslint v8 |
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import { fixupConfigRules } from "@eslint/compat"; | ||
|
||
import { compat } from "../lib/compat"; | ||
|
||
const jsxA11y = compat.extends("plugin:jsx-a11y/strict"); | ||
const jsxA11y = fixupConfigRules( | ||
compat.extends("plugin:jsx-a11y/strict"), | ||
) satisfies FlatConfig.ConfigArray; | ||
|
||
export default jsxA11y; |
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,27 +1,33 @@ | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import { fixupConfigRules } from "@eslint/compat"; | ||
|
||
import { compat } from "../lib/compat"; | ||
|
||
const tailwind = [ | ||
...compat.extends("plugin:tailwindcss/recommended"), | ||
...compat.config({ | ||
/* | ||
tailwind-variantsを併用する際に、`ignoredKeys`に | ||
`responsiveVariants`が追加されていないのでWarningが出る | ||
そのため、こちら側で`ignoredKeys`に`responsiveVariants`を追加している | ||
本家にPRを送るのでMergeされたらいらなくなる | ||
*/ | ||
rules: { | ||
"tailwindcss/no-custom-classname": [ | ||
"warn", | ||
{ | ||
ignoredKeys: [ | ||
"compoundVariants", | ||
"defaultVariants", | ||
"responsiveVariants", | ||
], | ||
}, | ||
], | ||
}, | ||
}), | ||
]; | ||
...fixupConfigRules(compat.extends("plugin:tailwindcss/recommended")), | ||
...fixupConfigRules( | ||
compat.config({ | ||
/* | ||
tailwind-variantsを併用する際に、`ignoredKeys`に | ||
`responsiveVariants`が追加されていないのでWarningが出る | ||
そのため、こちら側で`ignoredKeys`に`responsiveVariants`を追加している | ||
本家にPRを送るのでMergeされたらいらなくなる | ||
*/ | ||
rules: { | ||
"tailwindcss/no-custom-classname": [ | ||
"warn", | ||
{ | ||
ignoredKeys: [ | ||
"compoundVariants", | ||
"defaultVariants", | ||
"responsiveVariants", | ||
], | ||
}, | ||
], | ||
}, | ||
}), | ||
), | ||
] satisfies FlatConfig.ConfigArray; | ||
|
||
export default tailwind; |
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,12 +1,14 @@ | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
import type { Linter } from "eslint"; | ||
|
||
import eslintPluginAstro from "eslint-plugin-astro"; | ||
|
||
const astroConfig: Linter.FlatConfig[] = [ | ||
...eslintPluginAstro.configs["flat/recommended"], | ||
const astroConfig = [ | ||
// eslint-plugin-astroの型定義の都合上anyと判定されてしまうので、asを使って型を指定する | ||
...(eslintPluginAstro.configs["flat/recommended"] as Linter.Config[]), | ||
// flat/jsx-a11y-strictは、eslint-plugin-jsx-a11yの設定をベースにしているので、 | ||
// インストールされていないとエラーになるが、このパッケージはdependenciesに含まれているので問題ない | ||
...eslintPluginAstro.configs["flat/jsx-a11y-strict"], | ||
]; | ||
...(eslintPluginAstro.configs["flat/jsx-a11y-strict"] as Linter.Config[]), | ||
] satisfies FlatConfig.ConfigArray; | ||
|
||
export { astroConfig }; |
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,8 +1,11 @@ | ||
import type { Linter } from "eslint"; | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import js from "@eslint/js"; | ||
import gitignore from "eslint-config-flat-gitignore"; | ||
|
||
const jsConfig: Linter.FlatConfig[] = [gitignore(), js.configs.recommended]; | ||
const jsConfig = [ | ||
gitignore(), | ||
js.configs.recommended, | ||
] satisfies FlatConfig.ConfigArray; | ||
|
||
export { jsConfig }; |
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,38 +1,32 @@ | ||
import type { Linter } from "eslint"; | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
//@ts-expect-error no types | ||
import react from "eslint-plugin-react"; | ||
//@ts-expect-error no types | ||
import reactRecommended from "eslint-plugin-react/configs/recommended.js"; | ||
import { fixupConfigRules } from "@eslint/compat"; | ||
import globals from "globals"; | ||
|
||
import { compat } from "../lib/compat"; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const reactConfig: Linter.FlatConfig[] = [ | ||
...compat.extends("plugin:react-hooks/recommended"), | ||
{ | ||
files: ["**/*.{js,cjs,mjs,ts,cts,mts,jsx,tsx}"], | ||
...reactRecommended, | ||
languageOptions: { | ||
|
||
const reactConfig = [ | ||
...fixupConfigRules([ | ||
...compat.extends( | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:react-hooks/recommended", | ||
), | ||
...compat.config({ | ||
globals: { | ||
...globals.browser, | ||
}, | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
rules: { | ||
"react/jsx-boolean-value": "warn", | ||
"react/jsx-curly-brace-presence": "error", | ||
}, | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
}, | ||
plugins: { | ||
// no types | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
react, | ||
}, | ||
rules: { | ||
"react/jsx-boolean-value": "warn", | ||
"react/jsx-curly-brace-presence": "error", | ||
}, | ||
}, | ||
]; | ||
}), | ||
]), | ||
] satisfies FlatConfig.ConfigArray; | ||
|
||
export { reactConfig }; |
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,42 +1,38 @@ | ||
import type { Linter } from "eslint"; | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import prettierConfig from "eslint-config-prettier"; | ||
// @ts-expect-error no types | ||
import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural"; | ||
import perfectionistPlugin from "eslint-plugin-perfectionist"; | ||
|
||
// eslint-plugin-perfectionist has no types | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const stylisticConfig: Linter.FlatConfig[] = [ | ||
const stylisticConfig = [ | ||
prettierConfig, | ||
perfectionistNatural, | ||
perfectionistPlugin.configs["recommended-natural"], | ||
{ | ||
rules: { | ||
"perfectionist/sort-object-types": [ | ||
"error", | ||
{ | ||
"order": "asc", | ||
"partition-by-new-line": true, | ||
"type": "natural", | ||
order: "asc", | ||
partitionByNewLine: true, | ||
type: "natural", | ||
}, | ||
], | ||
"perfectionist/sort-objects": [ | ||
"error", | ||
{ | ||
"order": "asc", | ||
"partition-by-new-line": true, | ||
"type": "natural", | ||
order: "asc", | ||
partitionByNewLine: true, | ||
type: "natural", | ||
}, | ||
], | ||
"perfectionist/sort-union-types": [ | ||
"error", | ||
{ | ||
"nullable-last": true, | ||
"order": "asc", | ||
"type": "natural", | ||
order: "asc", | ||
type: "natural", | ||
}, | ||
], | ||
}, | ||
}, | ||
]; | ||
] satisfies FlatConfig.ConfigArray; | ||
|
||
export { stylisticConfig }; |
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,15 +1,15 @@ | ||
import type { TSESLint } from "@typescript-eslint/utils"; | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import tseslint from "typescript-eslint"; | ||
|
||
import { astroConfig } from "../base/astro"; | ||
import { reactConfig } from "../base/react"; | ||
import ts from "./ts"; | ||
|
||
const astro: TSESLint.FlatConfig.ConfigArray = tseslint.config( | ||
const astro = tseslint.config( | ||
...ts, | ||
...astroConfig, | ||
...reactConfig, | ||
); | ||
) satisfies FlatConfig.ConfigArray; | ||
|
||
export default astro; |
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,6 +1,8 @@ | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import { jsConfig } from "../base/js"; | ||
import { stylisticConfig } from "../base/stylistic"; | ||
|
||
const js = [...jsConfig, ...stylisticConfig]; | ||
const js = [...jsConfig, ...stylisticConfig] satisfies FlatConfig.ConfigArray; | ||
|
||
export default js; |
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,13 +1,13 @@ | ||
import type { TSESLint } from "@typescript-eslint/utils"; | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import tseslint from "typescript-eslint"; | ||
|
||
import { nextJsConfig } from "../base/nextjs"; | ||
import ts from "./ts"; | ||
|
||
const react: TSESLint.FlatConfig.ConfigArray = tseslint.config( | ||
const react = tseslint.config( | ||
...ts, | ||
...nextJsConfig, | ||
); | ||
) satisfies FlatConfig.ConfigArray; | ||
|
||
export default react; |
Oops, something went wrong.