Skip to content

Commit

Permalink
Update ESLint configuration and tsconfig to include JavaScript files …
Browse files Browse the repository at this point in the history
…so that everything works

It was throwing errors without these.
  • Loading branch information
Adamik10 committed Jan 2, 2025
1 parent 450bb29 commit 40fa6cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 31 deletions.
49 changes: 19 additions & 30 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
"plugin:prettier/recommended",
"plugin:cypress/recommended"
],
"plugins": [
"no-only-tests"
],
"plugins": ["no-only-tests"],
"settings": {
"react": {
"version": "16.11.0"
},
// Since we use vitest alongside our production code we have to instruct eslint
// not to throw the import/no-extraneous-dependencies error when doing so.
"import/core-modules": [
"vitest"
]
"import/core-modules": ["vitest"]
},
"env": {
"browser": true,
Expand All @@ -31,7 +27,7 @@
"allowImportExportEverywhere": false,
"ecmaFeatures": {
"jsx": true,
"globalReturn": false,
"globalReturn": false
},
"project": "./tsconfig.json"
},
Expand All @@ -47,9 +43,7 @@
"error",
{
"props": true,
"ignorePropertyModificationsFor": [
"state"
]
"ignorePropertyModificationsFor": ["state"]
}
],
"import/no-extraneous-dependencies": [
Expand Down Expand Up @@ -89,10 +83,10 @@
},
"overrides": [
{
"files": [
"*.js",
"*.jsx"
],
"files": ["*.js", "*.jsx"],
"parserOptions": {
"project": null
},
"rules": {
// These rules were triggered on the former non-typescript codebase.
// We are planning to use only ts/tsx in the future
Expand All @@ -104,15 +98,17 @@
"react/destructuring-assignment": "off",
"@typescript-eslint/return-await": "off",
"no-param-reassign": "off",
"@typescript-eslint/no-var-requires": "off"
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/no-implied-eval": "off",
"@typescript-eslint/no-throw-literal": "off"
// End - ddb-react former code
}
},
{
"files": [
"*.tsx",
"*.ts"
],
"files": ["*.tsx", "*.ts"],
"rules": {
// We do not use prop-types in ts.
"react/prop-types": "off",
Expand All @@ -121,9 +117,7 @@
"no-underscore-dangle": [
"error",
{
"allow": [
"__typename"
]
"allow": ["__typename"]
}
],
"react/forbid-elements": [
Expand All @@ -140,19 +134,14 @@
}
},
{
"files": [
"*.dev.jsx",
"*.dev.tsx"
],
"files": ["*.dev.jsx", "*.dev.tsx"],
"rules": {
// We need a simple way of passing args in stories via object spreading.
"react/jsx-props-no-spreading": "off",
"react/jsx-props-no-spreading": "off"
}
},
{
"files": [
"*.entry.tsx"
],
"files": ["*.entry.tsx"],
"rules": {
// Since we use High Order Functional Component in entries for text props
// and want to show the props being used we disable this rule.
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"types": ["cypress", "node", "vitest/importMeta"],
"target": "es6"
},
"include": ["src/**/*.ts", "src/**/*.tsx", "cypress/**/*.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"],
"ts-node": {
// these options are overrides used only by ts-node
"compilerOptions": {
Expand Down

0 comments on commit 40fa6cc

Please sign in to comment.