diff --git a/packages/client/.eslintrc.cjs b/packages/client/.eslintrc.cjs new file mode 100644 index 0000000000..2d54a41b0e --- /dev/null +++ b/packages/client/.eslintrc.cjs @@ -0,0 +1,10 @@ +module.exports = { + extends: "../shared/.eslintrc.cjs", + parserOptions: { + project: "tsconfig.eslint.json", + tsconfigRootDir: __dirname, + sourceType: "module", + }, + + ignorePatterns: ["./tsconfig.json", "coverage/**", "storybook-static/**"], +}; diff --git a/packages/client/package.json b/packages/client/package.json index cba193fbbd..7d14c388fc 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -59,6 +59,7 @@ }, "devDependencies": { "@babel/core": "^7.21.3", + "@babel/eslint-parser": "^7.21.8", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-export-default-from": "^7.18.10", "@babel/plugin-transform-runtime": "^7.21.0", @@ -66,10 +67,23 @@ "@babel/preset-react": "^7.18.6", "@babel/preset-typescript": "^7.21.0", "@svgr/webpack": "^5.5.0", + "@types/eslint": "^8.44.7", + "@typescript-eslint/eslint-plugin": "^6.12.0", + "@typescript-eslint/parser": "^6.12.0", "babel-loader": "^8.3.0", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^9.1.0", "css-loader": "^6.7.3", + "eslint": "^8.54.0", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-jsx-a11y": "^6.8.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-storybook": "^0.6.15", "external-remotes-plugin": "^1.0.0", "file-loader": "^6.2.0", "html-loader": "^4.2.0", diff --git a/packages/client/tsconfig.eslint.json b/packages/client/tsconfig.eslint.json new file mode 100644 index 0000000000..037ebb9ba7 --- /dev/null +++ b/packages/client/tsconfig.eslint.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "include": [ + // 👇️ add all the directories and files + // that you want to lint here + "src", + // add all files in which you see + // the "parserOptions.project" error + ".eslintrc.cjs", + "__mocks__", + "jest.config.ts", + ".storybook", + "babel.config.ts", + "index.d.ts", + "tsconfig.eslint.json" + ] +} diff --git a/packages/client/tsconfig.json b/packages/client/tsconfig.json index b3a4c00f28..264823ce78 100644 --- a/packages/client/tsconfig.json +++ b/packages/client/tsconfig.json @@ -1,21 +1,12 @@ { + "extends": "../shared/tsconfig.json", "compilerOptions": { - "outDir": "./dist/", - "target": "es2016", - "jsx": "react-jsx", - "module": "ESNext", + "rootDir": "./", "baseUrl": "./", - "moduleResolution": "node", - - "strict": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "skipLibCheck": true, - "allowJs": true, "paths": { "PUBLIC_DIR": ["../../public"], "COMMON_DIR": ["../common"], - "SRC_DIR": ["./src"] - } - } + "SRC_DIR": ["./src"], + }, + }, } diff --git a/packages/shared/package.json b/packages/shared/package.json index 4cfefb654a..f7bc3fa7d5 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -169,4 +169,3 @@ "react-dom": "^18.2.0" } } - diff --git a/yarn.lock b/yarn.lock index d873415e42..749943a73b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2958,6 +2958,7 @@ __metadata: resolution: "@docspace/client@workspace:packages/client" dependencies: "@babel/core": "npm:^7.21.3" + "@babel/eslint-parser": "npm:^7.21.8" "@babel/plugin-proposal-class-properties": "npm:^7.18.6" "@babel/plugin-proposal-export-default-from": "npm:^7.18.10" "@babel/plugin-transform-runtime": "npm:^7.21.0" @@ -2965,12 +2966,25 @@ __metadata: "@babel/preset-react": "npm:^7.18.6" "@babel/preset-typescript": "npm:^7.21.0" "@svgr/webpack": "npm:^5.5.0" + "@types/eslint": "npm:^8.44.7" + "@typescript-eslint/eslint-plugin": "npm:^6.12.0" + "@typescript-eslint/parser": "npm:^6.12.0" babel-loader: "npm:^8.3.0" clean-webpack-plugin: "npm:^4.0.0" copy-to-clipboard: "npm:^3.3.3" copy-webpack-plugin: "npm:^9.1.0" css-loader: "npm:^6.7.3" element-resize-detector: "npm:^1.2.4" + eslint: "npm:^8.54.0" + eslint-config-airbnb: "npm:^19.0.4" + eslint-config-airbnb-typescript: "npm:^17.1.0" + eslint-config-prettier: "npm:^9.0.0" + eslint-plugin-import: "npm:^2.29.0" + eslint-plugin-jsx-a11y: "npm:^6.8.0" + eslint-plugin-prettier: "npm:^5.0.1" + eslint-plugin-react: "npm:^7.33.2" + eslint-plugin-react-hooks: "npm:^4.6.0" + eslint-plugin-storybook: "npm:^0.6.15" external-remotes-plugin: "npm:^1.0.0" file-loader: "npm:^6.2.0" file-saver: "npm:^2.0.5"