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

Upgrade eslint to v7, update rules #827

Merged
merged 6 commits into from May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 61 additions & 18 deletions .eslintrc.js
Expand Up @@ -6,9 +6,13 @@ module.exports = {
project: "./tsconfig.json",
},
extends: [
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
// Use the recommended rules from the @typescript-eslint/eslint-plugin
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"prettier/@typescript-eslint",
// Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
"plugin:prettier/recommended",
],
plugins: [],
rules: {
Expand All @@ -30,39 +34,78 @@ module.exports = {
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
// "@typescript-eslint/explicit-function-return-type": [
// "warn",
// {
// allowExpressions: true,
// allowTypedFunctionExpressions: true,
// },
// ],
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-non-null-assertion": "off", // This is necessary for Map.has()/get()!
"@typescript-eslint/no-inferrable-types": [
"error",
{
"ignoreProperties": true,
"ignoreParameters": true
}
ignoreProperties: true,
ignoreParameters: true,
},
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": false,
"ts-ignore": true,
"ts-nocheck": true,
"ts-check": false,
},
],
"@typescript-eslint/restrict-template-expressions": [
"error",
{
allowNumber: true,
allowBoolean: true,
// This is necessary to log errors
// TODO: Consider switching to false when we may annotate catch clauses
allowAny: true,
allowNullish: true,
},
],
"@typescript-eslint/ban-ts-ignore": "warn",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: false,
},
],
// We can turn this on from time to time but in general these rules
// make our lives harder instead of easier
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-call": "off",
},
overrides: [
{
files: ["*.test.ts"],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-member-return": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/unbound-method": "warn",
},
},
{
files: ["*.js"],
rules: {
"@typescript-eslint/*": "off"
}
}
"@typescript-eslint/*": "off",
},
},
],
};