1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
Description: Avoid node module typescript
Author: Jonas Smedegaard <dr@jones.dk>
Last-Update: 2020-12-08
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/configs/es5.js
+++ b/lib/configs/es5.js
@@ -7,7 +7,6 @@
module.exports = {
extends: [
require.resolve("./_base.js"),
- require.resolve("./_override-ts.js"),
require.resolve("./_override-vue.js"),
require.resolve("./_override-mocha.js"),
require.resolve("./_override-special.js"),
--- a/lib/foreign-rules/ts.js
+++ b/lib/foreign-rules/ts.js
@@ -3,17 +3,3 @@
* See LICENSE file in root directory for full license.
*/
"use strict"
-
-// This import requires `typescript` package. The MODULE_NOT_FOUND error should
-// be ignored if people want to lint only JS.
-let rules = null
-try {
- rules = require("@typescript-eslint/eslint-plugin").rules
-} catch (_error) {
- rules = {}
-}
-
-module.exports = Object.keys(rules).reduce((obj, ruleId) => {
- obj[`ts/${ruleId}`] = rules[ruleId]
- return obj
-}, {})
--- a/lib/configs/_override-ts.js
+++ b/lib/configs/_override-ts.js
@@ -3,129 +3,3 @@
* See LICENSE file in root directory for full license.
*/
"use strict"
-
-module.exports = {
- overrides: [
- {
- files: ["*.ts", "*.tsx"],
- extends: [require.resolve("./+modules.js")],
- parser: require.resolve("@typescript-eslint/parser"),
- parserOptions: {
- loggerFn: false,
- project: "tsconfig.json",
- },
- rules: {
- // Enabled rules
- "@mysticatea/ts/adjacent-overload-signatures": "error",
- "@mysticatea/ts/array-type": "error",
- "@mysticatea/ts/await-thenable": "error",
- "@mysticatea/ts/ban-ts-ignore": "error",
- "@mysticatea/ts/class-name-casing": "error",
- "@mysticatea/ts/consistent-type-assertions": "error",
- "@mysticatea/ts/explicit-member-accessibility": "error",
- "@mysticatea/ts/interface-name-prefix": "error",
- "@mysticatea/ts/member-naming": "error",
- "@mysticatea/ts/no-array-constructor": "error",
- "@mysticatea/ts/no-empty-interface": "error",
- "@mysticatea/ts/no-extraneous-class": "error",
- "@mysticatea/ts/no-floating-promises": "error",
- "@mysticatea/ts/no-for-in-array": "error",
- "@mysticatea/ts/no-inferrable-types": "error",
- "@mysticatea/ts/no-misused-new": "error",
- "@mysticatea/ts/no-misused-promises": "error",
- "@mysticatea/ts/no-parameter-properties": "error",
- "@mysticatea/ts/no-require-imports": "error",
- "@mysticatea/ts/no-this-alias": [
- "error",
- { allowDestructuring: true },
- ],
- "@mysticatea/ts/no-unnecessary-qualifier": "error",
- "@mysticatea/ts/no-unnecessary-type-arguments": "error",
- "@mysticatea/ts/no-unnecessary-type-assertion": "error",
- "@mysticatea/ts/no-var-requires": "error",
- // https://github.com/typescript-eslint/typescript-eslint/issues/454
- "@mysticatea/ts/prefer-function-type": "off",
- "@mysticatea/ts/prefer-includes": "error",
- "@mysticatea/ts/prefer-namespace-keyword": "error",
- // https://github.com/typescript-eslint/typescript-eslint/issues/946
- "@mysticatea/ts/prefer-readonly": "off",
- "@mysticatea/ts/prefer-regexp-exec": "error",
- "@mysticatea/ts/prefer-string-starts-ends-with": "error",
- "@mysticatea/ts/restrict-plus-operands": "error",
- "@mysticatea/ts/require-array-sort-compare": "error",
- "@mysticatea/ts/triple-slash-reference": "error",
- // なんか誤検知が多い...
- "@mysticatea/ts/unbound-method": [
- "off",
- { ignoreStatic: true },
- ],
- // https://github.com/typescript-eslint/typescript-eslint/issues/452
- "@mysticatea/ts/unified-signatures": "off",
- "@mysticatea/prettier": [
- "error",
- {
- tabWidth: 4,
- semi: false,
- trailingComma: "all",
- parser: "typescript",
- },
- {
- usePrettierrc: false,
- },
- ],
-
- // Replacements
- camelcase: "off",
- "@mysticatea/ts/camelcase": "error",
- "no-empty-function": "off",
- "@mysticatea/ts/no-empty-function": "error",
- "no-useless-constructor": "off",
- "@mysticatea/ts/no-useless-constructor": "error",
- "require-await": "off",
- "@mysticatea/ts/require-await": "error",
-
- // Disabled rules
- "func-style": "off",
- "init-declarations": "off",
- "lines-between-class-members": "off",
- "no-dupe-class-members": "off",
- "no-invalid-this": "off",
- "no-loop-func": "off",
- "no-redeclare": "off",
- "no-undef": "off",
- "no-unused-vars": "off",
- "no-use-before-define": "off",
- "one-var": "off",
- "@mysticatea/ts/ban-types": "off",
- "@mysticatea/ts/consistent-type-definitions": "off",
- "@mysticatea/ts/explicit-function-return-type": "off", // I want but this is not so...
- "@mysticatea/ts/func-call-spacing": "off", // favor of Prettier.
- "@mysticatea/ts/generic-type-naming": "off",
- "@mysticatea/ts/indent": "off", // favor of Prettier.
- "@mysticatea/ts/member-delimiter-style": "off", // favor of Prettier.
- "@mysticatea/ts/member-ordering": "off",
- "@mysticatea/ts/no-explicit-any": "off",
- "@mysticatea/ts/no-extra-parens": "off", // favor of Prettier.
- "@mysticatea/ts/no-magic-numbers": "off",
- "@mysticatea/ts/no-namespace": "off", // I like the namespace for interfaces (type only things).
- "@mysticatea/ts/no-non-null-assertion": "off",
- "@mysticatea/ts/no-type-alias": "off",
- "@mysticatea/ts/no-unused-vars": "off", // tsc verifies it.
- "@mysticatea/ts/no-use-before-define": "off", // tsc verifies it.
- "@mysticatea/ts/prefer-for-of": "off",
- "@mysticatea/ts/promise-function-async": "off",
- "@mysticatea/ts/quotes": "off", // favor of Prettier.
- "@mysticatea/ts/semi": "off", // favor of Prettier.
- "@mysticatea/ts/strict-boolean-expressions": "off",
- "@mysticatea/ts/type-annotation-spacing": "off", // favor of Prettier.
- "@mysticatea/ts/typedef": "off",
- },
- },
- {
- files: ["*.d.ts"],
- rules: {
- strict: "off",
- },
- },
- ],
-}
--- a/tests/lib/configs/ts.js
+++ b/tests/lib/configs/ts.js
@@ -4,22 +4,3 @@
* See LICENSE file in root directory for full license.
*/
"use strict"
-
-const assert = require("assert")
-const Rules = require("./_rules")
-
-describe("'ts.js'", () => {
- const config = require("../../../lib/configs/_override-ts")
- const configuredRules = Rules.getRulesOfConfig(config, "_override-ts")
- const existingRules = Rules.getPluginRuleNames("ts")
-
- it("should be a valid config.", () => {
- Rules.validateConfig(config, "ts.js")
- })
-
- for (const ruleId of existingRules) {
- it(`should include existing rule '${ruleId}'.`, () => {
- assert(ruleId in configuredRules)
- })
- }
-})
|