🚨(frontend) create package eslint-config-people

We want to lint the e2e tests, we export the eslint config from the
app desk to a package in order to use it for the e2e tests and
for our apps.
This commit is contained in:
Anthony LC
2024-01-19 09:26:33 +01:00
committed by Anthony LC
parent 3b155b708c
commit c2c6ae88db
15 changed files with 2402 additions and 166 deletions

View File

@@ -1,133 +1,14 @@
module.exports = {
extends: [
'next',
'plugin:prettier/recommended',
'plugin:@tanstack/eslint-plugin-query/recommended',
'plugin:jsx-a11y/recommended',
],
root: true,
extends: ['people/next'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
settings: {
next: {
rootDir: __dirname,
},
'jsx-a11y': {
polymorphicPropName: 'as',
components: {
Input: 'input',
Button: 'button',
Box: 'div',
Text: 'span',
Select: 'select',
},
},
},
parserOptions: {
babelOptions: {
presets: [require.resolve('next/babel')],
},
},
rules: {
'block-scoped-var': 'error',
curly: ['error', 'all'],
'import/no-duplicates': ['error', { considerQueryString: false }],
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
pathGroups: [
{
pattern: '@/**',
group: 'internal',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'always',
},
],
'no-alert': 'error',
'no-unused-vars': [
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never', propElementValues: 'always' },
],
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],
},
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],
},
},
{
files: ['*.spec.*', '*.test.*', '**/__mock__/**/*'],
plugins: ['jest'],
extends: ['plugin:jest/recommended', 'plugin:testing-library/react'],
rules: {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'testing-library/no-await-sync-events': [
'error',
{ eventModules: ['fire-event'] },
],
'testing-library/await-async-events': [
'error',
{
eventModule: 'userEvent',
},
],
'testing-library/no-manual-cleanup': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],
'react/display-name': 0,
'jest/expect-expect': 'error',
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
},
],
ignorePatterns: ['.eslintrc.js'],
};

View File

@@ -24,7 +24,6 @@
"zustand": "4.4.7"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "5.17.1",
"@tanstack/react-query-devtools": "5.17.12",
"@testing-library/jest-dom": "6.2.0",
"@testing-library/react": "14.1.2",
@@ -32,15 +31,8 @@
"@types/node": "*",
"@types/react": "18.2.47",
"@types/react-dom": "18.2.18",
"@typescript-eslint/eslint-plugin": "6.18.1",
"dotenv": "16.3.1",
"eslint": "8.0.1",
"eslint-config-next": "14.0.4",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "27.6.2",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-prettier": "5.1.2",
"eslint-plugin-testing-library": "6.2.0",
"eslint-config-people": "*",
"fetch-mock": "9.11.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",