-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Make ESLint config stricter ## ♻️ Current situation & Problem Current ESLint config is fine, but it can be configured way strictier. It enforces good practives, improves quality of the code and guarantees consistency. ## ⚙️ Release Notes * Make ESLint config stricter ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md). --------- Co-authored-by: Paul Schmiedmayer <[email protected]>
- Loading branch information
1 parent
ad9c339
commit aaaa9cb
Showing
11 changed files
with
388 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,112 @@ | ||
{ | ||
"extends": ["next/core-web-vitals", "prettier"], | ||
"plugins": ["prettier"], | ||
"ignorePatterns": ["**/dist/*.js", "/docs/**", "/out/**"], | ||
"plugins": ["prettier", "@typescript-eslint", "import"], | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"extends": [ | ||
"plugin:@typescript-eslint/strict-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
"next/core-web-vitals", | ||
"prettier" | ||
], | ||
"ignorePatterns": [ | ||
"**/dist/*", | ||
"/docs/**", | ||
"/out/**", | ||
"**/jest.config.js", | ||
"**/next.config.js", | ||
"**/postcss.config.js", | ||
"**/tailwind.config.js" | ||
], | ||
"rules": { | ||
"prettier/prettier": "error" | ||
} | ||
"prettier/prettier": "error", | ||
"import/order": [ | ||
"warn", | ||
{ | ||
"groups": ["builtin", "external", "internal", ["parent", "sibling"]], | ||
"pathGroupsExcludedImportTypes": ["builtin"], | ||
"newlines-between": "never", | ||
"alphabetize": { | ||
"order": "asc", | ||
"caseInsensitive": true | ||
} | ||
} | ||
], | ||
"import/no-empty-named-blocks": "error", | ||
"import/no-mutable-exports": "error", | ||
"import/no-cycle": "error", | ||
"import/extensions": [ | ||
"warn", | ||
"always", | ||
{ | ||
"ts": "never", | ||
"tsx": "never", | ||
"js": "never", | ||
"jsx": "never", | ||
"mjs": "never" | ||
} | ||
], | ||
"import/newline-after-import": "warn", | ||
"import/no-anonymous-default-export": "warn", | ||
"import/no-default-export": "error", | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"warn", | ||
{ | ||
"prefer": "type-imports", | ||
"fixStyle": "inline-type-imports", | ||
"disallowTypeAnnotations": false | ||
} | ||
], | ||
"@typescript-eslint/no-misused-promises": [ | ||
"error", | ||
{ | ||
"checksVoidReturn": { | ||
"attributes": false | ||
} | ||
} | ||
], | ||
"import/no-duplicates": [ | ||
"error", | ||
{ | ||
"prefer-inline": true | ||
} | ||
], | ||
// false negatives | ||
"import/namespace": ["off"], | ||
"no-empty-pattern": "off", | ||
// make sure to `await` inside try…catch | ||
"@typescript-eslint/return-await": ["error", "in-try-catch"], | ||
"@typescript-eslint/no-confusing-void-expression": [ | ||
"error", | ||
{ "ignoreArrowShorthand": true } | ||
], | ||
// empty interfaces are fine, e.g. React component that extends other component, but with no additional props | ||
"@typescript-eslint/no-empty-interface": "off", | ||
"@typescript-eslint/array-type": [ | ||
"warn", | ||
{ "default": "array-simple", "readonly": "array-simple" } | ||
], | ||
// allow unused vars prefixed with `_` | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" } | ||
], | ||
// numbers and booleans are fine in template strings | ||
"@typescript-eslint/restrict-template-expressions": [ | ||
"error", | ||
{ "allowNumber": true, "allowBoolean": true } | ||
], | ||
"react/no-unescaped-entities": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["app/**/*.ts?(x)"], | ||
"rules": { | ||
"import/no-default-export": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project | ||
# | ||
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
# | ||
# SPDX-License-Identifier: MIT | ||
# | ||
|
||
**/dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.