-
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.
* fix: astro config works correctly * デフォルトで TS プリセットを同梱する * chore: update snapshot (github-actions) * Create orange-crabs-fetch.md Signed-off-by: Kentaro Suzuki <[email protected]> --------- Signed-off-by: Kentaro Suzuki <[email protected]> Co-authored-by: actions-miku[bot] <185786754+actions-miku[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d3ddb73
commit d4ac1db
Showing
7 changed files
with
2,527 additions
and
276 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": patch | ||
--- | ||
|
||
Astroプリセットを FlatConfig に移行 |
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,13 +1,53 @@ | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
import * as astroESLintParser from "astro-eslint-parser"; | ||
import astroPlugin from "eslint-plugin-astro"; | ||
import tseslint from "typescript-eslint"; | ||
import * as typescriptESLintParserForExtraFiles from "typescript-eslint-parser-for-extra-files"; | ||
|
||
import eslintPluginAstro from "eslint-plugin-astro"; | ||
import { __dirname } from "../lib/dir"; | ||
import { astroFiles, tsFiles } from "../utils/files"; | ||
import { jsConfig } from "./js"; | ||
import { stylisticConfig } from "./stylistic"; | ||
import { tsConfig } from "./typescript"; | ||
|
||
const astroConfig = [ | ||
// eslint-plugin-astroの型定義の都合上anyと判定されてしまうので、asを使って型を指定する | ||
...eslintPluginAstro.configs["flat/recommended"], | ||
// flat/jsx-a11y-strictは、eslint-plugin-jsx-a11yの設定をベースにしているので、 | ||
// インストールされていないとエラーになるが、このパッケージはdependenciesに含まれているので問題ない | ||
...eslintPluginAstro.configs["flat/jsx-a11y-strict"], | ||
] satisfies FlatConfig.ConfigArray; | ||
|
||
export { astroConfig }; | ||
export const astroConfig = tseslint.config( | ||
{ | ||
files: [tsFiles], | ||
languageOptions: { | ||
parser: typescriptESLintParserForExtraFiles, | ||
parserOptions: { | ||
project: true, | ||
projectService: false, | ||
tsconfigRootDir: __dirname, | ||
}, | ||
}, | ||
}, | ||
{ | ||
extends: [ | ||
...jsConfig, | ||
...stylisticConfig, | ||
...tsConfig, | ||
...astroPlugin.configs.recommended, | ||
...astroPlugin.configs["jsx-a11y-strict"], | ||
], | ||
files: [astroFiles], | ||
languageOptions: { | ||
parser: astroESLintParser, | ||
parserOptions: { | ||
parser: typescriptESLintParserForExtraFiles, | ||
project: true, | ||
projectService: false, | ||
tsconfigRootDir: __dirname, | ||
}, | ||
}, | ||
name: "@virtual-live-lab/eslint-config/astro", | ||
rules: { | ||
"astro/no-set-html-directive": "error", | ||
"astro/no-set-text-directive": "error", | ||
"astro/no-unused-css-selector": "error", | ||
"astro/prefer-class-list-directive": "error", | ||
"astro/prefer-object-class-list": "error", | ||
"astro/prefer-split-class-list": "error", | ||
"astro/sort-attributes": "error", | ||
}, | ||
}, | ||
); |
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,8 @@ | ||
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint"; | ||
|
||
import tseslint from "typescript-eslint"; | ||
|
||
import { astroConfig } from "../base/astro"; | ||
import react from "./react"; | ||
import ts from "./ts"; | ||
|
||
const astro = tseslint.config( | ||
...react, | ||
...astroConfig, | ||
) satisfies FlatConfig.ConfigArray; | ||
const astro = tseslint.config(...ts, ...astroConfig); | ||
|
||
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,3 +1,4 @@ | ||
export const tsFiles = "**/*.{ts,tsx,mts,cts}"; | ||
export const jsFiles = "**/*.{js,jsx,mjs,cjs}"; | ||
export const jsxFiles = "**/*.{jsx,tsx}"; | ||
export const astroFiles = "**/*.astro"; |
Oops, something went wrong.