Skip to content

Commit

Permalink
chore: change eslint config to Flat Config
Browse files Browse the repository at this point in the history
  • Loading branch information
nameless-mc committed Oct 8, 2024
1 parent 071259c commit 5a833a6
Show file tree
Hide file tree
Showing 8 changed files with 539 additions and 340 deletions.
12 changes: 0 additions & 12 deletions .eslintignore

This file was deleted.

33 changes: 0 additions & 33 deletions .eslintrc.js

This file was deleted.

57 changes: 57 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import presetsNodeTypescriptPrettier from "@cybozu/eslint-config/flat/presets/node-typescript-prettier.js";
import websiteConfig from "./website/eslint.config.mjs";
import featuresConfig from "./features/eslint.config.mjs";

export default [
{
ignores: [
"**/lib",
"**/dist",
"**/coverage",
"**/allure-report",
"**/allure-results",
// website package
"website/.docusaurus",
"website/build",
// Auto generated file
"website/contributors.json",
],
},
...presetsNodeTypescriptPrettier,
{
rules: {
curly: ["error", "all"],
"func-style": ["error"],

"@typescript-eslint/no-empty-object-type": "off",

"@typescript-eslint/no-wrapper-object-types": "off",

"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
},
],

"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
},
],
"n/no-missing-import": "off",
},
},
...websiteConfig.map((configObject) => ({
files: ["website/**/*.{js,cjs,mjs,ts,cts,mts,jsx,tsx}"],
...configObject,
})),
...featuresConfig.map((configObject) => ({
files: ["features/**/*.{js,cjs,mjs,ts,cts,mts,jsx,tsx}"],
...configObject,
})),
];
21 changes: 21 additions & 0 deletions features/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default [
{
rules: {
"new-cap": [
"warn",
{
capIsNewExceptions: [
"Given",
"When",
"Then",
"BeforeAll",
"Before",
"AfterAll",
"After",
],
},
],
"no-invalid-this": "off",
},
},
];
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"test:e2e:dev": "pnpm test:e2e --fail-fast",
"test:e2e:ci": "pnpm clean:test && node ./scripts/run-e2e-in-parallel.mjs",
"lint": "run-p -l lint:*",
"lint:eslint": "eslint --ext .js,.mjs,.cjs,.jsx,.ts,.mts,.cts,.tsx ./ --max-warnings 0 --cache --cache-location ./node_modules/.cache/eslint/",
"lint:eslint": "eslint ./ --max-warnings 0 --cache --cache-location ./node_modules/.cache/eslint/",
"lint:prettier": "prettier --check '**/*.{json,md,yml,yaml}' --cache",
"fix": "run-p fix:*",
"fix:lint": "run-s 'lint:eslint --fix'",
Expand Down Expand Up @@ -69,7 +69,7 @@
"@babel/preset-env": "^7.25.7",
"@babel/preset-typescript": "^7.25.7",
"@cucumber/cucumber": "^10.9.0",
"@cybozu/eslint-config": "^23.0.0",
"@cybozu/eslint-config": "^24.0.0-beta.0",
"@cybozu/license-manager": "^1.2.1",
"@octokit/rest": "^20.1.1",
"@types/jest": "^29.5.13",
Expand Down
Loading

0 comments on commit 5a833a6

Please sign in to comment.