Skip to content

Commit

Permalink
migrated to use new linting config for frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
ARADDCC002 committed Jan 28, 2025
1 parent 1389b83 commit 32ad97e
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 32 deletions.
29 changes: 0 additions & 29 deletions frontend/.eslintrc.json

This file was deleted.

72 changes: 72 additions & 0 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import prettier from 'eslint-plugin-prettier'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import cypress from 'eslint-plugin-cypress'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'next/core-web-vitals',
),
),
{
plugins: {
'@typescript-eslint': fixupPluginRules(typescriptEslint),
prettier,
'simple-import-sort': simpleImportSort,
cypress,
},

languageOptions: {
parser: tsParser,
},

rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],

'@typescript-eslint/no-extra-semi': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-expressions': 'off',

'react/jsx-newline': [
1,
{
prevent: true,
},
],

'cypress/no-async-tests': 'off',
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'no-console': 'warn',
},
},
]
25 changes: 25 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
"uuid": "^10.0.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.19.0",
"@next/bundle-analyzer": "^14.2.4",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/Form/JsonSchemaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export default function JsonSchemaForm({
}
}
>
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<></>
</Form>
</Grid2>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/entry/overview/ExportEntryCardDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default function ExportEntryCardDialog({ entry, splitSchema, open, setOpe
ObjectFieldTemplate,
}}
>
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<></>
</Form>
))
Expand Down
1 change: 0 additions & 1 deletion frontend/src/errors/MultipleErrorWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import DefaultErrorWrapper from './ErrorWrapper'

export default function MultipleErrorWrapper(generic: string, errors: any, ErrorWrapper: any = DefaultErrorWrapper) {
for (const key of Object.keys(errors)) {
// eslint-disable-next-line react/destructuring-assignment
const error = errors[key]

if (error) {
Expand Down

0 comments on commit 32ad97e

Please sign in to comment.