Skip to content

Commit

Permalink
fix checking eslint.config.mjs by eslint and tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Mar 7, 2024
1 parent d8e3964 commit 52fa100
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
14 changes: 11 additions & 3 deletions playground/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export default ts.config(
eslint.configs.recommended,
...ts.configs.recommendedTypeChecked,
{
files: ['index.ts', 'test.ts', 'lib.d.ts'],
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
project: 'tsconfig.json',
},
},
},
{
files: ['index.ts', 'test.ts'],
files: ['*.ts', '*.mjs'],
rules: {
indent: ['error', 4],
quotes: ['error', 'single'],
Expand All @@ -39,5 +39,13 @@ export default ts.config(
'mocha/no-skipped-tests': 'error',
'mocha/no-top-level-hooks': 'error',
},
},
{
files: ['eslint.config.mjs', 'eslint.d.ts'],
languageOptions: {
parserOptions: {
project: 'tsconfig.eslint.json',
},
},
}
);
10 changes: 10 additions & 0 deletions playground/eslint.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare module 'eslint-plugin-mocha' {
export default {
configs: {
flat: {
all: unknown,
recommended: unknown,
},
},
};
}
8 changes: 4 additions & 4 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"main": "main.js",
"scripts": {
"lint:stylelint": "stylelint style.css",
"lint:prettier": "prettier --check \"*.ts\"",
"lint:eslint": "eslint --max-warnings 0 \"*.ts\"",
"lint:eslintconfig": "tsc --checkJs --noEmit --module nodenext --strict eslint.config.mjs",
"lint:prettier": "prettier --check '*.ts' '*.mjs'",
"lint:eslint": "eslint --max-warnings 0 '*.ts' '*.mjs'",
"lint:eslintconfig": "tsc --checkJs --noEmit -p tsconfig.eslint.json",
"lint": "npm run lint:prettier && npm run lint:eslint && npm run lint:stylelint && npm run lint:eslintconfig",
"prettier": "prettier --write \"*.ts\"",
"prettier": "prettier --write '*.ts' '*.mjs'",
"build": "tsc -p .",
"watch": "tsc -p . --watch",
"serve": "http-server . -p 1234",
Expand Down
11 changes: 11 additions & 0 deletions playground/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext"
},
"files": [
"eslint.config.mjs",
"eslint.d.ts"
]
}

0 comments on commit 52fa100

Please sign in to comment.