chore: add ESLint

This commit is contained in:
MAZE 2023-10-05 16:45:52 +03:30
parent 297f7a77af
commit be2a66e207
4 changed files with 3431 additions and 4 deletions

3
.eslintignore Normal file
View File

@ -0,0 +1,3 @@
node_modules/
dist/
.output/

88
.eslintrc.json Normal file
View File

@ -0,0 +1,88 @@
{
"root": true,
"env": {
"browser": true,
"amd": true,
"node": true,
"es2022": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:jsx-a11y/recommended",
"plugin:react-hooks/recommended",
"plugin:astro/recommended"
],
"plugins": ["@typescript-eslint", "sort-keys-fix", "sort-destructure-keys"],
"rules": {
"sort-keys-fix/sort-keys-fix": ["warn", "asc"],
"sort-destructure-keys/sort-destructure-keys": "warn",
"react/jsx-sort-props": [
"warn",
{
"callbacksLast": true,
"multiline": "last"
}
]
},
"settings": {
"react": {
"version": "detect"
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx", ".js", ".jsx"]
},
"import/resolver": {
"typescript": true,
"node": true
}
},
"overrides": [
{
"files": ["**/*.astro"],
"parser": "astro-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"extraFileExtensions": [".astro"]
},
"rules": {
"prettier/prettier": "error",
"react/no-unknown-property": "off"
},
"globals": {
"Astro": "readonly"
}
},
{
"files": ["**/*.astro/*.js"],
"rules": {
"prettier/prettier": "off"
}
}
]
}

3326
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,9 @@
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.astro",
"lint:fix": "npm run lint -- --fix"
},
"dependencies": {
"@astrojs/react": "^3.0.3",
@ -16,5 +18,19 @@
"astro": "^3.2.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "6.7.4",
"@typescript-eslint/parser": "6.7.4",
"astro-eslint-parser": "0.16.0",
"eslint": "8.50.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-astro": "0.29.1",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-sort-destructure-keys": "1.5.0",
"eslint-plugin-sort-keys-fix": "1.1.2"
}
}