Skip to content

Commit

Permalink
build: used typescript-eslint@v6 with reworked configs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg authored and nicolo-ribaudo committed Jul 12, 2023
1 parent ddbbaf6 commit 9de7dff
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 100 deletions.
135 changes: 93 additions & 42 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,50 +74,101 @@ module.exports = [
"import/no-extraneous-dependencies": "error",
},
},
{
files: ["**/*.ts"],
languageOptions: {
parser: parserTypeScriptESLint,
parserOptions: {
project: "./tsconfig.json",
},
},
plugins: {
"@typescript-eslint": pluginTypeScriptESLint,
},
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": "error",
"no-undef": "off",
"no-redeclare": "off",
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": { descriptionFormat: "^\\(Babel 7 vs Babel 8\\) .+$" },
...compat
.extends(
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked"
)
.map(config => {
return {
...config,
files: ["**/*.ts"],
languageOptions: {
parser: parserTypeScriptESLint,
parserOptions: {
project: "./tsconfig.eslint.json",
},
},
],
"@typescript-eslint/consistent-type-imports": [
"error",
{ disallowTypeAnnotations: false },
],
"@typescript-eslint/no-use-before-define": [
"error",
{
functions: false,
classes: false,
allowNamedExports: true,
plugins: {
"@typescript-eslint": pluginTypeScriptESLint,
},
],
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-confusing-void-expression": [
"error",
{ ignoreArrowShorthand: true },
],
"@typescript-eslint/no-import-type-side-effects": "error",
},
},
rules: {
...config.rules,
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": "error",
"no-undef": "off",
"no-redeclare": "off",
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": {
descriptionFormat: "^\\(Babel 7 vs Babel 8\\) .+$",
},
},
],
"@typescript-eslint/consistent-type-imports": [
"error",
{ disallowTypeAnnotations: false },
],
"@typescript-eslint/no-use-before-define": [
"error",
{
functions: false,
classes: false,
allowNamedExports: true,
},
],
"@typescript-eslint/no-confusing-void-expression": [
"error",
{ ignoreArrowShorthand: true },
],
"@typescript-eslint/no-import-type-side-effects": "error",

// Todo: Investigate, for each of these, whether we want them
"@typescript-eslint/array-type": "off",
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/consistent-generic-constructors": "off",
"@typescript-eslint/consistent-indexed-object-style": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-duplicate-type-constituents": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/prefer-string-starts-ends-with": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/sort-type-constituents": "off",
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/unbound-method": "off",
"prefer-rest-params": "off",

// https://github.com/typescript-eslint/typescript-eslint/issues/5014
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-return": "off",
},
};
}),
{
files: sourceFiles("js,ts,cjs,mjs"),
languageOptions: {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"@rollup/plugin-replace": "^5.0.2",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.3",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-plugin-transform-charcodes": "^0.2.0",
"c8": "^7.12.0",
"chalk": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-types/src/converters/toStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function toStatement(node: t.Node, ignore?: boolean): t.Statement | false {

// @ts-expect-error todo(flow->ts): node.id might be missing
if (mustHaveId && !node.id) {
newType = false as false;
newType = false;
}

if (!newType) {
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"strict": true
}
}

0 comments on commit 9de7dff

Please sign in to comment.