chore: introduce ESlint (#201)
This commit is contained in:
88
eslint.config.mjs
Normal file
88
eslint.config.mjs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
import globals from 'globals';
|
||||||
|
import eslint from '@eslint/js';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||||
|
import eslintPluginReact from 'eslint-plugin-react';
|
||||||
|
import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
|
||||||
|
import * as eslintPluginImport from 'eslint-plugin-import';
|
||||||
|
import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
|
||||||
|
import eslintPluginOnlyWarn from 'eslint-plugin-only-warn';
|
||||||
|
import eslintPluginNext from '@next/eslint-plugin-next';
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
{
|
||||||
|
name: 'unittcms/ignore-globally',
|
||||||
|
ignores: ['**/node_modules/', '**/.next/', '**/docs/'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'unittcms/load-plugins',
|
||||||
|
languageOptions: {
|
||||||
|
sourceType: 'module',
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.node,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
import: eslintPluginImport,
|
||||||
|
'unused-imports': eslintPluginUnusedImports,
|
||||||
|
react: eslintPluginReact,
|
||||||
|
'react-hooks': eslintPluginReactHooks,
|
||||||
|
'@next/next': eslintPluginNext,
|
||||||
|
'only-warn': eslintPluginOnlyWarn,
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: 'detect',
|
||||||
|
},
|
||||||
|
next: {
|
||||||
|
rootDir: './*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// Following settings ar on/off rules
|
||||||
|
{
|
||||||
|
name: 'unittcms/global-tuning',
|
||||||
|
extends: [eslint.configs.recommended],
|
||||||
|
rules: {
|
||||||
|
'import/order': 'error',
|
||||||
|
'unused-imports/no-unused-imports': 'error',
|
||||||
|
'unused-imports/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
vars: 'all',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
args: 'after-used',
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'unittcms/for-typescript',
|
||||||
|
files: ['**/*.ts', '**/*.tsx'],
|
||||||
|
extends: [
|
||||||
|
tseslint.configs.strict,
|
||||||
|
eslintPluginReact.configs.flat.recommended,
|
||||||
|
eslintPluginReact.configs.flat['jsx-runtime'],
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-namespace': 'off',
|
||||||
|
'react/prop-types': 'off',
|
||||||
|
...eslintPluginReactHooks.configs.recommended.rules,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'unittcms/for-nextjs',
|
||||||
|
files: ['frontend/**/*.{ts,tsx,js,jsx}'],
|
||||||
|
rules: {
|
||||||
|
...eslintPluginNext.configs.recommended.rules,
|
||||||
|
...eslintPluginNext.configs['core-web-vitals'].rules,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'eslint-config-prettier',
|
||||||
|
...eslintConfigPrettier,
|
||||||
|
}
|
||||||
|
);
|
||||||
2605
frontend/package-lock.json
generated
2605
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -22,8 +22,6 @@
|
|||||||
"boring-avatars": "^1.11.2",
|
"boring-avatars": "^1.11.2",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"eslint": "8.57.1",
|
|
||||||
"eslint-config-next": "14.2.24",
|
|
||||||
"framer-motion": "^11.18.2",
|
"framer-motion": "^11.18.2",
|
||||||
"intl-messageformat": "^10.7.15",
|
"intl-messageformat": "^10.7.15",
|
||||||
"lucide-react": "^0.475.0",
|
"lucide-react": "^0.475.0",
|
||||||
|
|||||||
4663
package-lock.json
generated
4663
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -7,17 +7,29 @@
|
|||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"coverage": "vitest run --coverage",
|
"coverage": "vitest run --coverage",
|
||||||
"e2e": "playwright test",
|
"e2e": "playwright test",
|
||||||
"report": "playwright show-report"
|
"report": "playwright show-report",
|
||||||
|
"lint": "eslint",
|
||||||
|
"lint:fix": "eslint --fix"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@next/eslint-plugin-next": "^15.3.0",
|
||||||
"@playwright/test": "^1.48.2",
|
"@playwright/test": "^1.48.2",
|
||||||
"@types/node": "^22.8.1",
|
"@types/node": "^22.8.1",
|
||||||
"@vitest/coverage-v8": "^1.6.0",
|
"@vitest/coverage-v8": "^1.6.0",
|
||||||
|
"eslint": "^9.24.0",
|
||||||
|
"eslint-config-next": "^15.3.0",
|
||||||
|
"eslint-config-prettier": "^10.1.2",
|
||||||
|
"eslint-plugin-import": "^2.31.0",
|
||||||
|
"eslint-plugin-only-warn": "^1.1.0",
|
||||||
|
"eslint-plugin-react": "^7.37.5",
|
||||||
|
"eslint-plugin-unused-imports": "^4.1.4",
|
||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
|
"globals": "^16.0.0",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"sequelize": "^6.37.4",
|
"sequelize": "^6.37.4",
|
||||||
"sqlite3": "^5.1.7",
|
"sqlite3": "^5.1.7",
|
||||||
"supertest": "^7.0.0",
|
"supertest": "^7.0.0",
|
||||||
|
"typescript-eslint": "^8.24.1",
|
||||||
"vitest": "^1.6.0"
|
"vitest": "^1.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user