Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/eslint config #28

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: ESlint configuration
Adds specify rules to ESlint
Adds react and import plugins to ESlint

Part of #16
rfgvieira committed Jun 26, 2024
commit 4404758bf626159c08f6487112a40dc21f3684b0
126 changes: 115 additions & 11 deletions dashboard/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -2,19 +2,123 @@ module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
'plugin:@tanstack/eslint-plugin-query/recommended'
"eslint:recommended",
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
],
ignorePatterns: [".eslintrc.cjs", "*.config.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
requireConfigFile: false,
ecmaVersion: 2021,
sourceType: "module",
project: ["./tsconfig.app.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
settings: {
react: {
version: "detect",
},
},
plugins: [
"react-refresh",
"import",
"react",
"react-hooks",
"@typescript-eslint",
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
"no-duplicate-imports": "warn",
"no-magic-numbers": [
"error",
{
detectObjects: false,
ignore: [-1, 0, 1, 2],
ignoreArrayIndexes: true,
ignoreDefaultValues: true,
},
],
"no-restricted-imports": [
"error",
{
patterns: ["../../*"],
},
],
"no-shadow": "off",
"no-underscore-dangle": ["error", { allow: ["__typename"] }],
"no-unused-vars": "off",
"no-use-before-define": "off",
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/no-shadow": ["warn", { ignoreTypeValueShadow: true }],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
jsx: "never",
ts: "never",
tsx: "never",
},
],
"import/no-cycle": ["error", { ignoreExternal: true }],
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: [
"**/*{.,_}{test,spec}.{ts,tsx}",
".storybook/**",
"src/stories/**",
],
},
],
"import/order": [
"error",
{
groups: [
["builtin", "external"],
"internal",
"parent",
["index", "sibling"],
],
"newlines-between": "always-and-inside-groups",
},
],
"import/prefer-default-export": "off",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
"react/destructuring-assignment": "off",
"react/jsx-filename-extension": [
"error",
{
extensions: [".tsx"],
},
],
"react/jsx-key": ["error", { checkFragmentShorthand: true }],
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": "off",
},
}
};
3 changes: 3 additions & 0 deletions dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -24,3 +24,6 @@ dist-ssr
*.sw?

*storybook.log

# eslint cache
.eslintcache
4 changes: 3 additions & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
"build": "tsc -b && vite build",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"lint": "eslint **/*.tsx **/*.ts --report-unused-disable-directives --max-warnings 0",
"lint": "eslint --cache --max-warnings=0 --ext .ts,.tsx,.js,.jsx src --fix",
"preview": "vite preview",
"prepare": "cd .. && husky dashboard/.husky",
"pycommit": "cd .. && cd backend && sh pre-commit",
@@ -46,6 +46,8 @@
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"eslint-plugin-storybook": "^0.8.0",
703 changes: 703 additions & 0 deletions dashboard/pnpm-lock.yaml

Large diffs are not rendered by default.