Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web): migrate eslint to v9 #1168

Merged
merged 14 commits into from
Jun 5, 2024
6 changes: 0 additions & 6 deletions web/.eslintignore

This file was deleted.

20 changes: 0 additions & 20 deletions web/.eslintrc.yml

This file was deleted.

1 change: 1 addition & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dist-ssr
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
Expand Down
12 changes: 12 additions & 0 deletions web/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "avoid",
"proseWrap": "preserve"
}
6 changes: 6 additions & 0 deletions web/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
21 changes: 21 additions & 0 deletions web/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"eslint.enable": true,
"eslint.useFlatConfig": true,
"prettier.enable": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
65 changes: 65 additions & 0 deletions web/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import config from "eslint-config-reearth";
import playwright from "eslint-plugin-playwright";
import storybook from "eslint-plugin-storybook";
import globals from "globals";

/** @type { import("eslint").Linter.FlatConfig[] } */

export default [
...config,
{
rules: {
"import/order": [
"warn",
{
pathGroups: [
{
pattern: "@reearth-cms/**",
group: "external",
position: "after",
},
],
pathGroupsExcludedImportTypes: ["builtin"],
"newlines-between": "always",
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
"node/no-extraneous-import": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-invalid-void-type": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/consistent-type-definitions": "warn",
"@typescript-eslint/array-type": "warn",
"@typescript-eslint/consistent-indexed-object-style": "warn",
},
},
{
files: ["*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],
plugins: {
storybook: storybook,
},
},
{
...playwright.configs["flat/recommended"],
files: ["e2e/**/*"],
languageOptions: {
globals: {
...globals.browser,
},
},
},
{
ignores: [
"dist/*",
"coverage/*",
"node_modules/*",
"storybook-static/*",
"!.storybook/",
".storybook/public/*",
"src/gql/graphql-client-api.tsx",
],
},
];
2 changes: 1 addition & 1 deletion web/i18next-parser.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
locales: ["en", "ja"],
output: "src/i18n/translations/$LOCALE.yml",
input: ["src/**/*.{ts,tsx}"],
Expand Down
12 changes: 8 additions & 4 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "reearth-cms",
"version": "0.0.0",
"license": "Apache-2.0",
"type": "module",
"private": true,
"main": "./dist/reearth-cms.es.js",
"browser": "./dist/reearth-cms.umd.js",
Expand All @@ -19,7 +20,8 @@
"coverage": "vitest run --coverage",
"e2e": "playwright test",
"lint": "eslint .",
"format": "eslint . --fix",
"fix": "eslint --fix .",
"format": "prettier --write .",
"type": "tsc",
"gql": "graphql-codegen --config codegen.yml",
"i18n": "i18next",
Expand Down Expand Up @@ -60,16 +62,18 @@
"@types/react-router-dom": "5.3.3",
"@vitejs/plugin-react": "4.3.0",
"@vitest/coverage-v8": "1.6.0",
"eslint": "8.57.0",
"eslint-config-reearth": "0.3.0",
"eslint": "9.3.0",
"eslint-config-reearth": "0.3.4",
"eslint-plugin-playwright": "1.6.2",
"eslint-plugin-storybook": "0.8.0",
"globals": "15.3.0",
"i18next-parser": "8.13.0",
"jest": "29.7.0",
"jsdom": "24.0.0",
"less": "4.2.0",
"msw": "2.2.14",
"npm-run-all": "4.1.5",
"prettier": "3.2.5",
"prettier": "3.3.0",
"prop-types": "15.8.1",
"read-env": "2.0.0",
"storybook": "8.0.8",
Expand Down
File renamed without changes.
Loading
Loading