ESLint parity with the Browsertrix repo (#288)
This copies the rules from the Browsertrix repo, and uses [`suppress-eslint-errors`](https://www.npmjs.com/package/suppress-eslint-errors) to suppose the violations. I'll take a pass at cleaning this up at some point in the future, and let's do our best to address these in the future as we come across them :) This'll help ensure new code being added to this repo is held to the same standard as code in Browsertrix's frontend.
This commit is contained in:
+17
-7
@@ -30,6 +30,7 @@ module.exports = {
|
||||
fixStyle: "inline-type-imports",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/consistent-type-exports": "error",
|
||||
"@typescript-eslint/prefer-readonly": "warn",
|
||||
"@typescript-eslint/class-literal-property-style": ["warn", "getters"],
|
||||
"@typescript-eslint/consistent-generic-constructors": "error",
|
||||
@@ -41,6 +42,13 @@ module.exports = {
|
||||
// "@typescript-eslint/prefer-nullish-coalescing": "warn",
|
||||
"@typescript-eslint/prefer-optional-chain": "warn",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/no-meaningless-void-operator": "error",
|
||||
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
|
||||
"@typescript-eslint/no-unnecessary-condition": "warn",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "warn",
|
||||
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
|
||||
"@typescript-eslint/prefer-reduce-type-parameter": "warn",
|
||||
"@typescript-eslint/promise-function-async": "warn",
|
||||
/* end stylistic rules */
|
||||
|
||||
/* start recommended rules */
|
||||
@@ -48,13 +56,13 @@ module.exports = {
|
||||
"@typescript-eslint/no-base-to-string": "warn",
|
||||
"@typescript-eslint/no-duplicate-enum-values": "error",
|
||||
"@typescript-eslint/no-duplicate-type-constituents": "warn",
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||
// "@typescript-eslint/no-floating-promises": "warn",
|
||||
"@typescript-eslint/no-floating-promises": "warn",
|
||||
"@typescript-eslint/no-for-in-array": "warn",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
@@ -68,7 +76,7 @@ module.exports = {
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-misused-promises": [
|
||||
"error",
|
||||
{ checksVoidReturn: { arguments: false } },
|
||||
{ checksVoidReturn: false },
|
||||
],
|
||||
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
||||
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
|
||||
@@ -76,18 +84,20 @@ module.exports = {
|
||||
"@typescript-eslint/no-this-alias": "warn",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
|
||||
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
|
||||
// "@typescript-eslint/no-unsafe-argument": "warn",
|
||||
/* TODO eventually turn all these on */
|
||||
"@typescript-eslint/no-unsafe-argument": "warn",
|
||||
// "@typescript-eslint/no-unsafe-assignment": "warn",
|
||||
// "@typescript-eslint/no-unsafe-call": "warn",
|
||||
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
|
||||
"@typescript-eslint/no-unsafe-enum-comparison": "warn",
|
||||
// "@typescript-eslint/no-unsafe-member-access": "warn",
|
||||
// "@typescript-eslint/no-unsafe-return": "warn",
|
||||
"@typescript-eslint/no-unsafe-return": "warn",
|
||||
"@typescript-eslint/prefer-as-const": "warn",
|
||||
"require-await": "off",
|
||||
"@typescript-eslint/require-await": "warn",
|
||||
// "@typescript-eslint/require-await": "warn",
|
||||
"@typescript-eslint/restrict-template-expressions": "warn",
|
||||
"@typescript-eslint/unbound-method": "off",
|
||||
"@typescript-eslint/method-signature-style": "error",
|
||||
},
|
||||
reportUnusedDisableDirectives: true,
|
||||
ignorePatterns: [
|
||||
|
||||
Reference in New Issue
Block a user