Skip to content

Commit 1230247

Browse files
fix: update typescript rules
1 parent 8e1167f commit 1230247

File tree

3 files changed

+16
-26
lines changed

3 files changed

+16
-26
lines changed

rollup.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import rollupPluginNodeResolve from "@rollup/plugin-node-resolve";
77
import rollupPluginTypescript from "@rollup/plugin-typescript";
88
import * as fs from "fs";
99
import path from "path";
10-
import type { RollupOptions } from "rollup";
10+
import type { Plugin, RollupOptions } from "rollup";
1111
import rollupPluginAutoExternal from "rollup-plugin-auto-external";
1212

1313
const configDir = "./src/configs/";
@@ -36,7 +36,7 @@ const common: Partial<RollupOptions> = {
3636
*/
3737
function getPlugins() {
3838
return [
39-
rollupPluginAutoExternal(),
39+
rollupPluginAutoExternal() as Plugin,
4040
rollupPluginNodeResolve(),
4141
rollupPluginCommonjs(),
4242
rollupPluginTypescript({

src/configs/typescript.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const baseConfig: Linter.Config = {
1313
"indent": "off",
1414
"no-constant-condition": "off",
1515
"no-loop-func": "off",
16+
"no-loss-of-precision": "off",
1617
"no-shadow": "off",
1718
"no-unused-expressions": "off",
1819
"no-unused-vars": "off",

src/plugins/typescript.ts

+13-24
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const settings: Linter.Config = {
6161
accessibility: "explicit",
6262
},
6363
],
64+
"@typescript-eslint/explicit‑module‑boundary‑types": "off",
6465
"@typescript-eslint/indent": ["error", 2],
6566
"@typescript-eslint/naming-convention": [
6667
"error",
@@ -108,7 +109,9 @@ export const settings: Linter.Config = {
108109
],
109110
"@typescript-eslint/no-invalid-void-type": "error",
110111
"@typescript-eslint/no-loop-func": "error",
112+
"@typescript-eslint/no-loss-of-precision": "error",
111113
"@typescript-eslint/no-non-null-assertion": "off",
114+
// "node" plugin will handle this.
112115
"@typescript-eslint/no-require-imports": "off",
113116
"@typescript-eslint/no-shadow": [
114117
"warn",
@@ -121,10 +124,11 @@ export const settings: Linter.Config = {
121124
"@typescript-eslint/no-throw-literal": "error",
122125
"@typescript-eslint/no-unnecessary-condition": "error",
123126
"@typescript-eslint/no-unnecessary-type-constraint": "error",
124-
"@typescript-eslint/no-unsafe-assignment": "off",
125-
"@typescript-eslint/no-unsafe-call": "off",
126-
"@typescript-eslint/no-unsafe-member-access": "off",
127-
"@typescript-eslint/no-unsafe-return": "off",
127+
"@typescript-eslint/no-unsafe-argument": "warn",
128+
"@typescript-eslint/no-unsafe-assignment": "warn",
129+
"@typescript-eslint/no-unsafe-call": "warn",
130+
"@typescript-eslint/no-unsafe-member-access": "warn",
131+
"@typescript-eslint/no-unsafe-return": "warn",
128132
"@typescript-eslint/no-unused-expressions": [
129133
"error",
130134
{
@@ -133,23 +137,16 @@ export const settings: Linter.Config = {
133137
allowTernary: true,
134138
},
135139
],
140+
"no-unused-vars": "off",
136141
"@typescript-eslint/no-unused-vars": [
137-
"off",
142+
"warn",
138143
{
139-
args: "after-used",
140-
argsIgnorePattern: "^_",
144+
args: "none",
141145
caughtErrors: "none",
142146
ignoreRestSiblings: true,
143147
vars: "all",
144148
},
145149
],
146-
"@typescript-eslint/no-unused-vars-experimental": [
147-
"warn",
148-
{
149-
ignoreArgsIfArgsAfterAreUsed: true,
150-
ignoredNamesRegex: "^_",
151-
},
152-
],
153150
"@typescript-eslint/no-use-before-define": [
154151
"error",
155152
{
@@ -159,7 +156,7 @@ export const settings: Linter.Config = {
159156
variables: true,
160157
},
161158
],
162-
"@typescript-eslint/no-var-requires": "off",
159+
"@typescript-eslint/no-var-requires": "error",
163160
"@typescript-eslint/non-nullable-type-assertion-style": "error",
164161
"@typescript-eslint/object-curly-spacing": ["error", "always"],
165162
"@typescript-eslint/prefer-for-of": "warn",
@@ -174,6 +171,7 @@ export const settings: Linter.Config = {
174171
ignoreInferredTypes: true,
175172
},
176173
],
174+
"@typescript-eslint/prefer-regexp-exec": "error",
177175
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
178176
"@typescript-eslint/prefer-ts-expect-error": "warn",
179177
"@typescript-eslint/promise-function-async": "error",
@@ -215,13 +213,4 @@ export const settings: Linter.Config = {
215213
],
216214
"@typescript-eslint/unified-signatures": "warn",
217215
},
218-
219-
overrides: [
220-
{
221-
files: ["**/*.ts", "**/*.tsx"],
222-
rules: {
223-
"@typescript-eslint/no-var-requires": "error",
224-
},
225-
},
226-
],
227216
};

0 commit comments

Comments
 (0)