Skip to content

Commit

Permalink
Split off eslintConfig from package.json into .eslintrc.cjs (#2740)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Nov 6, 2023
1 parent 3b54858 commit 8f9788c
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 98 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
**

# Except the following.
!docs/user_guide
!nginx
!public
!src
!docs/user_guide
!.env
!.eslintrc.cjs
!dev-requirements.txt
!package*.json
!tsconfig.json
!tox.ini
!tsconfig.json

# Ignore user guide build directory.
docs/user_guide/site
69 changes: 69 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
module.exports = {
env: {
browser: true,
jest: true,
},
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
],
ignorePatterns: ["*.dic.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: { jsx: true },
project: "./tsconfig.json",
},
plugins: ["@typescript-eslint", "react", "unused-imports"],
root: true,
rules: {
"import/first": "warn",
"import/newline-after-import": "warn",
"import/no-duplicates": "warn",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/order": [
"warn",
{
alphabetize: { order: "asc" },
groups: [
"builtin",
"external",
["internal", "parent", "sibling", "index", "object", "type"],
],
"newlines-between": "always",
},
],
"no-undef": "off",
"prefer-const": "warn",
"react/jsx-boolean-value": "warn",
"unused-imports/no-unused-imports": "warn",
},
settings: {
react: { version: "detect" },
"import/resolver": {
typescript: { alwaysTryTypes: true },
},
},
overrides: [
{
files: ["*.ts", "*.tsx"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
],
rules: {
"@typescript-eslint/explicit-function-return-type": [
"warn",
{ allowExpressions: true },
],
"@typescript-eslint/no-empty-interface": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/switch-exhaustiveness-check": "warn",
},
},
],
};
83 changes: 0 additions & 83 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,89 +125,6 @@
"source-map-explorer": "^2.5.3",
"typescript": "4.9.5"
},
"eslintConfig": {
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
],
"env": {
"browser": true,
"jest": true
},
"ignorePatterns": [
"*.dic.js"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
"allowExpressions": true
}
],
"@typescript-eslint/no-empty-interface": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"import/first": "warn",
"import/newline-after-import": "warn",
"import/no-duplicates": "warn",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/order": [
"warn",
{
"groups": [
"builtin",
"external",
[
"internal",
"parent",
"sibling",
"index",
"object",
"type"
]
],
"alphabetize": {
"order": "asc"
},
"newlines-between": "always"
}
],
"no-undef": "off",
"prefer-const": "warn",
"react/jsx-boolean-value": "warn",
"unused-imports/no-unused-imports": "warn"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint",
"react",
"unused-imports"
],
"root": true,
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
}
},
"jest": {
"coverageReporters": [
"cobertura",
Expand Down
2 changes: 1 addition & 1 deletion scripts/setupMongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as makeDir from "make-dir";

const directory = "./mongo_database";

const makeMongoDirectory = async () => {
const makeMongoDirectory = async (): Promise<void> => {
await makeDir(directory);
};

Expand Down
24 changes: 12 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"baseUrl": "src",
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"downlevelIteration": true,
"baseUrl": "src",
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es5"
},
"exclude": ["*.dic.js"],
"include": ["src", "scripts"]
"include": [".eslintrc.cjs", "src", "scripts"]
}

0 comments on commit 8f9788c

Please sign in to comment.