mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-09 23:06:21 -04:00
Most of the changed lines in this are from random breaking changes in typedoc meaning that lots of docstrings needed to be rewritten
279 lines
9.9 KiB
JavaScript
279 lines
9.9 KiB
JavaScript
const browserTargets = require("./browser-targets.json")
|
|
|
|
/*
|
|
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
|
|
https://github.com/typescript-eslint/tslint-to-eslint-config
|
|
|
|
It represents the closest reasonable ESLint configuration to this
|
|
project's original TSLint configuration.
|
|
|
|
We recommend eventually switching this configuration to extend from
|
|
the recommended rulesets in typescript-eslint.
|
|
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
|
|
|
|
Happy linting! 💖
|
|
*/
|
|
module.exports = {
|
|
"env": {
|
|
"browser": true,
|
|
"es6": true,
|
|
"node": true
|
|
},
|
|
"extends": [
|
|
"plugin:@typescript-eslint/recommended",
|
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
"prettier",
|
|
"plugin:sonarjs/recommended"
|
|
],
|
|
"parser": "@typescript-eslint/parser",
|
|
"parserOptions": {
|
|
"project": ["tsconfig.json", "tsconfig.eslint.json"],
|
|
"sourceType": "module"
|
|
},
|
|
"plugins": [
|
|
"@typescript-eslint",
|
|
"sonarjs"
|
|
],
|
|
"rules": {
|
|
"unsupported-apis-chrome": [
|
|
"warn",
|
|
{ "minimumVersion": browserTargets.chrome.minimumVersion }
|
|
],
|
|
"unsupported-apis-firefox": [
|
|
"warn",
|
|
{ "minimumVersion": browserTargets.firefox.minimumVersion }
|
|
],
|
|
"sonarjs/cognitive-complexity": "off", //"error",
|
|
"sonarjs/no-duplicate-string": "off",
|
|
"sonarjs/no-unused-collection": "off", //"error", // There seems to be a bug with this rule - exported collections are assumed unused
|
|
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
"@typescript-eslint/array-type": "off",
|
|
"@typescript-eslint/await-thenable": "error",
|
|
"@typescript-eslint/ban-ts-comment": "error",
|
|
"@typescript-eslint/no-restricted-types": [
|
|
"error",
|
|
{
|
|
"types": {
|
|
"KeyboardEvent": {
|
|
"message": "Use `TrustedKeyboardEvent` to prevent remote code injection from hostile pages."
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"@typescript-eslint/consistent-type-assertions": "error",
|
|
"@typescript-eslint/consistent-type-definitions": "error",
|
|
"@typescript-eslint/dot-notation": "off", // this should be "error" but the fix silently breaks code almost 100% of the time. not worth the headaches
|
|
"@typescript-eslint/explicit-member-accessibility": [
|
|
"off",
|
|
{
|
|
"accessibility": "explicit"
|
|
}
|
|
],
|
|
"@typescript-eslint/explicit-module-boundary-types": "off", //"warn", // This is another hard one to enable
|
|
"@typescript-eslint/member-ordering": [
|
|
"error",
|
|
{ "default": ["field", "constructor", "method"] },
|
|
],
|
|
"@typescript-eslint/no-array-delete": "off",
|
|
"@typescript-eslint/no-array-constructor": "error",
|
|
"@typescript-eslint/no-base-to-string": "off",
|
|
"@typescript-eslint/no-empty-function": "error",
|
|
"@typescript-eslint/no-explicit-any": "off",
|
|
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
"@typescript-eslint/no-floating-promises": "off", //"error", // We should turn this on eventually but it will take a while to fix
|
|
"@typescript-eslint/no-for-in-array": "error",
|
|
"@typescript-eslint/no-implied-eval": "error",
|
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
"@typescript-eslint/no-misused-new": "error",
|
|
"@typescript-eslint/no-misused-promises": ["error",
|
|
{
|
|
"checksVoidReturn": false,
|
|
},
|
|
],
|
|
"@typescript-eslint/no-namespace": "error",
|
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
"@typescript-eslint/no-this-alias": "error",
|
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
"@typescript-eslint/no-unsafe-assignment": "off", //"error",
|
|
"@typescript-eslint/no-unsafe-argument": "off", //"error",
|
|
"@typescript-eslint/no-unsafe-call": "off", //"error",
|
|
"@typescript-eslint/no-unsafe-member-access": "off", //"error", // We've done this a lot, but it would be a good idea to fix it
|
|
"@typescript-eslint/no-unsafe-return": "off", //"error", // We've done this a lot, but it would be a good idea to fix it
|
|
"@typescript-eslint/no-unused-expressions": [
|
|
"error",
|
|
{
|
|
"allowShortCircuit": true,
|
|
"allowTernary": true,
|
|
}
|
|
],
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
"args": "after-used",
|
|
"argsIgnorePattern": "^_",
|
|
"caughtErrors": "none",
|
|
"varsIgnorePattern": "^_",
|
|
},
|
|
],
|
|
"@typescript-eslint/no-use-before-define": "off",
|
|
"@typescript-eslint/only-throw-error": "off",
|
|
"@typescript-eslint/prefer-as-const": "error",
|
|
"@typescript-eslint/prefer-for-of": "error",
|
|
"@typescript-eslint/prefer-function-type": "error",
|
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
"@typescript-eslint/prefer-promise-reject-errors": "off",
|
|
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
"quotes": [
|
|
"error",
|
|
"double",
|
|
{
|
|
"avoidEscape": true,
|
|
"allowTemplateLiterals": true,
|
|
},
|
|
],
|
|
"@typescript-eslint/require-await": "error",
|
|
"@typescript-eslint/restrict-plus-operands": "off", //"error", // We use this a lot - fixing it is a problem for a rainy day
|
|
"@typescript-eslint/restrict-template-expressions": "off",
|
|
"@typescript-eslint/triple-slash-reference": [
|
|
"error",
|
|
{
|
|
"path": "always",
|
|
"types": "prefer-import",
|
|
"lib": "always"
|
|
}
|
|
],
|
|
"@typescript-eslint/unbound-method": "error",
|
|
"@typescript-eslint/unified-signatures": "error",
|
|
"arrow-body-style": "error",
|
|
"arrow-parens": [
|
|
"off",
|
|
"always"
|
|
],
|
|
"brace-style": [
|
|
"error",
|
|
"1tbs"
|
|
],
|
|
"camelcase": "off",
|
|
"comma-dangle": "off",
|
|
"complexity": "off",
|
|
"constructor-super": "error",
|
|
"curly": "off",
|
|
"eol-last": "error",
|
|
"eqeqeq": [
|
|
"off",
|
|
"always"
|
|
],
|
|
"guard-for-in": "error",
|
|
"id-blacklist": "off",
|
|
"id-match": "off",
|
|
"import/order": "off",
|
|
"jsdoc/check-alignment": "off",
|
|
"jsdoc/check-indentation": "off",
|
|
"max-classes-per-file": "off",
|
|
"max-len": "off",
|
|
"new-parens": "error",
|
|
"no-array-constructor": "off",
|
|
"no-bitwise": "error",
|
|
"no-caller": "error",
|
|
"no-cond-assign": "error",
|
|
"no-console": "off",
|
|
"no-debugger": "error",
|
|
"no-empty": [
|
|
"error",
|
|
{
|
|
"allowEmptyCatch": true
|
|
}
|
|
],
|
|
"no-empty-function": "off",
|
|
"no-eval": "off",
|
|
"no-fallthrough": "off",
|
|
"no-invalid-this": "off",
|
|
"no-multiple-empty-lines": "error",
|
|
"no-new-wrappers": "error",
|
|
"no-shadow": [
|
|
"off",
|
|
{
|
|
"hoist": "all"
|
|
}
|
|
],
|
|
"no-throw-literal": "error",
|
|
"no-trailing-spaces": "error",
|
|
"no-undef-init": "error",
|
|
"no-underscore-dangle": "off",
|
|
"no-unsafe-finally": "off",
|
|
"no-unused-labels": "error",
|
|
"no-unused-vars": "off",
|
|
"no-var": "error",
|
|
"object-shorthand": "error",
|
|
"one-var": [
|
|
"error",
|
|
"never"
|
|
],
|
|
"prefer-arrow/prefer-arrow-functions": "off",
|
|
"prefer-const": [
|
|
"error",
|
|
{
|
|
"destructuring": "all"
|
|
}
|
|
],
|
|
"quote-props": "off",
|
|
"radix": "error",
|
|
"require-await": "off",
|
|
"spaced-comment": [
|
|
"error",
|
|
"always",
|
|
{
|
|
"markers": [
|
|
"/"
|
|
]
|
|
}
|
|
],
|
|
"use-isnan": "error",
|
|
"valid-typeof": "off"
|
|
},
|
|
"overrides": [
|
|
{
|
|
"files": ["*.d.ts"],
|
|
"rules": {
|
|
"@typescript-eslint/no-unused-vars": "off",
|
|
},
|
|
},
|
|
{
|
|
"files": ["src/completions/*.ts", "src/excmds.ts"],
|
|
"rules": {
|
|
// We have methods that must be async in some classes but not in others
|
|
// In src/excmds anything that crosses between content<->background must be async even if it looks like it isn't
|
|
"@typescript-eslint/require-await": "off",
|
|
},
|
|
},
|
|
{
|
|
"files": ["src/lib/editor_utils.ts"],
|
|
"rules": {
|
|
// The regexes use the /g flag which match handles differently to exec
|
|
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
},
|
|
},
|
|
{
|
|
"files": ["src/content.ts", "src/commandline_frame.ts"],
|
|
"rules": {
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
"@typescript-eslint/no-restricted-types": [
|
|
"error",
|
|
{
|
|
"types": {
|
|
"TrustedKeyboardEvent": {
|
|
"message": "Events must be validated with `isTrustedKeyboardEvent` at runtime"
|
|
},
|
|
"KeyboardEvent": {
|
|
"message": "Use `Event` instead"
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
}
|
|
],
|
|
};
|