Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ import globals from "globals";
export default [
eslint.configs.recommended,
{
files: ["**/*.ts", "**/*.vue"],
files: ["**/*.ts", "**/*.tsx", "**/*.vue"],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tsparser,
ecmaVersion: "latest",
sourceType: "module",
// build 用 tsconfig は demo の .tsx を含まないので、型情報ルール用に lint 専用の設定を使う
project: ["./tsconfig.eslint.json"],
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: [".vue"],
},
globals: {
...globals.browser,
Expand All @@ -26,10 +30,22 @@ export default [
vue: vuePlugin,
},
rules: {
...tseslint.configs.recommended.rules,
...tseslint.configs.strict.rules,
// as を止める consistent-type-assertions は stylistic にしか入っていない
...tseslint.configs.stylistic.rules,
...vuePlugin.configs["flat/recommended"].rules,
"vue/multi-word-component-names": "off",
"@typescript-eslint/no-explicit-any": "off",
// 未定義参照は TypeScript 自身が検出する。型のみの参照 (React.FormEvent 等) を誤検出する
"no-undef": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/consistent-type-assertions": ["warn", { assertionStyle: "never" }],
// 型情報を使うルール。parserOptions.project から型が供給される
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/no-base-to-string": "error",
},
},
{
Expand Down
23 changes: 23 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true,
"emitDeclarationOnly": false,
"declaration": false,
"declarationDir": null,
"jsx": "react-jsx"
},
"include": [
"*.ts",
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"demo/**/*.ts",
"demo/**/*.tsx",
"demo/**/*.vue"
],
"exclude": [
"node_modules",
"dist"
]
}
6 changes: 6 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"declarationDir": "./dist",
"jsx": "preserve",
"strict": true,
"useUnknownInCatchVariables": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noPropertyAccessFromIndexSignature": true,
"exactOptionalPropertyTypes": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
Expand Down
Loading