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

[polish] eslint config #17

Merged
merged 1 commit into from
Nov 28, 2024
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
48 changes: 39 additions & 9 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import { fixupPluginRules } from '@eslint/compat';
import cspellPlugin from '@cspell/eslint-plugin';
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import reactPlugin from 'eslint-plugin-react';
import react from 'eslint-plugin-react';
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
import url from 'url';
import { fileURLToPath } from 'url';

const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
/**
* When using the ESLint extension, remember to check the "ESLint: Use Flat config" setting for instant code rule hints.
*/

const tsconfigRootDir = fileURLToPath(new URL('.', import.meta.url));

export default tsEslint.config(
// register all of the plugins up-front
{
plugins: {
'@typescript-eslint': tsEslint.plugin,
// https://github.com/jsx-eslint/eslint-plugin-react/issues/3699
react: fixupPluginRules(reactPlugin),
'simple-import-sort': simpleImportSortPlugin
// - https://github.com/jsx-eslint/eslint-plugin-react/issues/3838#issuecomment-2395472758
react: /** @type {import('eslint').ESLint.Plugin} */ (react),
'simple-import-sort': simpleImportSortPlugin,
'@cspell': cspellPlugin
}
},
{
Expand All @@ -38,13 +43,18 @@ export default tsEslint.config(
},
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
tsconfigRootDir,
warnOnUnsupportedTypeScriptVersion: false
}
},
rules: {
'arrow-body-style': ['error', 'as-needed'],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never' }
],
'react/jsx-no-target-blank': 'warn',
'react/jsx-sort-props': [
'error',
Expand All @@ -55,7 +65,27 @@ export default tsEslint.config(
noSortAlphabetically: true
}
],
'@typescript-eslint/no-empty-object-type': 'off'
'react/self-closing-comp': [
'error',
{ component: true, html: true }
],
'@typescript-eslint/no-empty-object-type': 'off',
'@cspell/spellchecker': [
'warn',
{
cspell: {
language: 'en',
dictionaries: [
'typescript',
'node',
'html',
'css',
'bash',
'npm'
]
}
}
]
}
},
{
Expand Down
92 changes: 52 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,86 @@
"description": "React project scaffold based on TypeScript, MobX & Bootstrap, which is inspired by WebCell scaffold.",
"author": "[email protected]",
"dependencies": {
"@editorjs/code": "^2.9.0",
"@editorjs/editorjs": "^2.30.5",
"@editorjs/header": "^2.8.7",
"@editorjs/image": "^2.9.3",
"@editorjs/code": "^2.9.3",
"@editorjs/editorjs": "^2.30.7",
"@editorjs/header": "^2.8.8",
"@editorjs/image": "^2.10.1",
"@editorjs/link": "^2.6.2",
"@editorjs/list": "^1.10.0",
"@editorjs/list": "^2.0.2",
"@editorjs/paragraph": "^2.11.6",
"@editorjs/quote": "^2.7.2",
"@editorjs/quote": "^2.7.4",
"browser-fs-access": "^0.35.0",
"browser-unhandled-rejection": "^1.0.2",
"echarts-jsx": "^1.2.1",
"editorjs-html": "^3.4.3",
"idea-react": "^2.0.0-rc.2",
"koajax": "^3.0.2",
"idea-react": "^2.0.0-rc.8",
"koajax": "^3.0.3",
"lodash": "^4.17.21",
"mobx": "^6.13.2",
"mobx-github": "^0.3.4",
"mobx-i18n": "^0.5.0",
"mobx": "^6.13.5",
"mobx-downloader": "^0.3.0",
"mobx-github": "^0.3.5",
"mobx-i18n": "^0.6.0",
"mobx-react": "^9.1.1",
"mobx-restful": "^1.0.1",
"mobx-restful": "^2.0.0",
"mobx-restful-table": "^2.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-bootstrap": "^2.10.4",
"react-bootstrap": "^2.10.6",
"react-bootstrap-editor": "^2.0.4",
"react-dom": "^18.3.1",
"react-editor-js": "^2.1.0",
"react-router-class-tools": "^0.1.3",
"react-router-dom": "^6.26.2",
"web-utility": "^4.4.0"
"react-router-dom": "^6.28.0",
"web-utility": "^4.4.2"
},
"devDependencies": {
"@babel/runtime": "^7.25.6",
"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.10.0",
"@parcel/config-default": "~2.12.0",
"@parcel/packager-raw-url": "~2.12.0",
"@parcel/transformer-less": "~2.12.0",
"@parcel/transformer-typescript-tsc": "~2.12.0",
"@parcel/transformer-webmanifest": "~2.12.0",
"@types/lodash": "^4.17.7",
"@types/node": "^20.16.5",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"@babel/runtime": "^7.26.0",
"@cspell/eslint-plugin": "^8.16.1",
"@eslint/compat": "^1.2.3",
"@eslint/js": "^9.15.0",
"@parcel/config-default": "~2.13.2",
"@parcel/packager-raw-url": "~2.13.2",
"@parcel/transformer-less": "~2.13.2",
"@parcel/transformer-typescript-tsc": "~2.13.2",
"@parcel/transformer-webmanifest": "~2.13.2",
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__eslintrc": "^2.1.2",
"@types/eslint__js": "^8.42.3",
"@types/lodash": "^4.17.13",
"@types/node": "^20.17.9",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.16.00",
"@typescript-eslint/parser": "^8.16.0",
"buffer": "^6.0.3",
"eslint": "^9.10.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-spellcheck": "^0.0.20",
"globals": "^15.9.0",
"husky": "^9.1.6",
"globals": "^15.12.0",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"parcel": "~2.12.0",
"parcel": "~2.13.2",
"parcel-transformer-mdx": "^0.4.2",
"prettier": "^3.3.3",
"postcss": "^8.4.49",
"prettier": "^3.4.1",
"prettier-plugin-css-order": "2.1.2",
"prismjs": "^1.29.0",
"process": "^0.11.10",
"typescript": "~5.6.2",
"typescript-eslint": "^8.5.0",
"workbox-cli": "^7.1.0"
"typescript": "~5.7.2",
"typescript-eslint": "^8.16.0",
"workbox-cli": "^7.3.0"
},
"prettier": {
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"tabWidth": 4
"tabWidth": 4,
"plugins": [
"prettier-plugin-css-order",
"@softonus/prettier-plugin-duplicate-remover"
]
},
"lint-staged": {
"*.{html,md,less,json,yml,js,mjs,ts,tsx}": "prettier --write",
Expand Down
Loading