chore: use common eslint config for most packages (#4705)

Split from https://github.com/twentyhq/twenty/pull/4518

Related to #4766 

Mutualizes eslint config between projects.
I didn't include `twenty-server` in this PR as this was causing too many
lint errors.
This commit is contained in:
Thaïs
2024-04-04 12:05:26 +02:00
committed by GitHub
parent ff0db8d716
commit bf8ee99ebb
28 changed files with 667 additions and 698 deletions

View File

@ -0,0 +1,32 @@
module.exports = {
extends: ['../../.eslintrc.cjs', '../../.eslintrc.react.cjs'],
ignorePatterns: ['!**/*'],
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
project: ['packages/twenty-ui/tsconfig.{json,*.json}'],
},
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@tabler/icons-react'],
message: 'Please import icons from `src/display`',
},
{
group: ['react-hotkeys-web-hook'],
importNames: ['useHotkeys'],
message:
'Please use the custom wrapper: `useScopedHotkeys` from `src/utilities`',
},
],
},
],
'@nx/dependency-checks': 'error',
},
},
],
};

View File

@ -1,25 +0,0 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*", "storybook-static"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}

View File

@ -1 +0,0 @@
dist

View File

@ -13,7 +13,18 @@
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
"options": {
"eslintConfig": "{projectRoot}/.eslintrc.cjs",
"ignorePath": "{workspaceRoot}/.gitignore",
"lintFilePatterns": [
"{projectRoot}/src/**/*.{ts,tsx,json}",
"{projectRoot}/package.json"
]
},
"configurations": {
"ci": { "lintFilePatterns": ["{projectRoot}/**/*.{ts,tsx,json}"] },
"fix": { "fix": true }
}
},
"test": {
"executor": "@nx/jest:jest",

View File

@ -2,17 +2,15 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node", "vite/client"]
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": [
"jest.config.ts",
"src/**/*.spec.ts",
"src/**/*.test.ts",
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.stories.ts",
"**/*.stories.js",
"**/*.stories.jsx",
"**/*.stories.tsx"
]
"**/*.stories.tsx",
"**/*.test.ts",
"**/*.test.tsx"
],
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.tsx"]
}

View File

@ -7,8 +7,9 @@
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.d.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
"src/**/*.test.ts",
"vite.config.ts"
]
}

View File

@ -4,29 +4,12 @@
"emitDecoratorMetadata": true,
"outDir": ""
},
"files": [
"../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nx/react/typings/image.d.ts"
],
"exclude": [
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.jsx",
"src/**/*.test.js"
],
"include": [
"src/**/*.stories.ts",
"src/**/*.stories.js",
"src/**/*.stories.jsx",
"src/**/*.stories.tsx",
"src/**/*.stories.mdx",
".storybook/*.js",
".storybook/*.ts",
".storybook/main.tsx"
".storybook/*.tsx",
"src/**/*.d.ts",
"src/**/*.stories.mdx",
"src/**/*.stories.ts",
"src/**/*.stories.tsx"
]
}