mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-26 17:52:59 +02:00
Add React and hooks ESLint plugins and config
Enhanced the ESLint configuration to include 'eslint-plugin-react', 'eslint-plugin-react-hooks', and 'globals' for improved React and browser environment linting. Updated rules and overrides for React files, test files, and Node.js scripts. Updated dependencies in package.json and package-lock.json to include the new plugins and bumped several related packages.
This commit is contained in:
parent
c76edebf0f
commit
3517f22c23
@ -1,18 +1,21 @@
|
||||
// @ts-check
|
||||
|
||||
import eslint from '@eslint/js';
|
||||
import globals from 'globals';
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
||||
import reactPlugin from 'eslint-plugin-react';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default defineConfig(
|
||||
eslint.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
{
|
||||
ignores: [
|
||||
"dist", // Contains 3rd party code
|
||||
"public", // Contains 3rd party code
|
||||
],
|
||||
},
|
||||
eslint.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
{
|
||||
rules: {
|
||||
"no-undef": "off", // Temporarily disabled until codebase conformant
|
||||
@ -28,15 +31,65 @@ export default defineConfig(
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"args": "all", // All function args must be used (or explicitly ignored)
|
||||
"argsIgnorePattern": "^_", // Allow unused variables beginning with an underscore
|
||||
"caughtErrors": "all", // Caught errors must be used (or explicitly ignored)
|
||||
"caughtErrorsIgnorePattern": "^_", // Allow unused variables beginning with an underscore
|
||||
"destructuredArrayIgnorePattern": "^_", // Allow unused variables beginning with an underscore
|
||||
"varsIgnorePattern": "^_", // Allow unused variables beginning with an underscore
|
||||
"ignoreRestSiblings": true, // Allow unused variables when removing attributes from objects (otherwise this requires explicit renaming like `({ x: _x, ...y }) => y`, which is clunky)
|
||||
args: 'all', // All function args must be used (or explicitly ignored)
|
||||
argsIgnorePattern: '^_', // Allow unused variables beginning with an underscore
|
||||
caughtErrors: 'all', // Caught errors must be used (or explicitly ignored)
|
||||
caughtErrorsIgnorePattern: '^_', // Allow unused variables beginning with an underscore
|
||||
destructuredArrayIgnorePattern: '^_', // Allow unused variables beginning with an underscore
|
||||
varsIgnorePattern: '^_', // Allow unused variables beginning with an underscore
|
||||
ignoreRestSiblings: true, // Allow unused variables when removing attributes from objects (otherwise this requires explicit renaming like `({ x: _x, ...y }) => y`, which is clunky)
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['src/**/*.{ts,tsx,js,jsx}'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
react: reactPlugin,
|
||||
'react-hooks': reactHooksPlugin,
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
'react-hooks/rules-of-hooks': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'src/**/*.{test,spec}.{ts,tsx}',
|
||||
'src/tests/**/*.{ts,tsx}',
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.vitest,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'scripts/**/*.{js,ts}',
|
||||
'vite.config.ts',
|
||||
'vitest.config.ts',
|
||||
'vitest.minimal.config.ts',
|
||||
'playwright.config.ts',
|
||||
'tailwind.config.js',
|
||||
'postcss.config.js',
|
||||
'eslint.config.mjs',
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
1768
frontend/package-lock.json
generated
1768
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@
|
||||
"jszip": "^3.10.1",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pdfjs-dist": "^3.11.174",
|
||||
"posthog-js": "^1.261.0",
|
||||
"posthog-js": "^1.268.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-i18next": "^15.5.2",
|
||||
@ -72,12 +72,6 @@
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"test:e2e:install": "playwright install"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
@ -101,6 +95,9 @@
|
||||
"@vitejs/plugin-react": "^4.5.0",
|
||||
"@vitest/coverage-v8": "^1.0.0",
|
||||
"eslint": "^9.34.0",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"globals": "^16.4.0",
|
||||
"jsdom": "^23.0.0",
|
||||
"license-checker": "^25.0.1",
|
||||
"madge": "^8.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user