Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for typescript-eslint v6 #48

Merged
merged 7 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
// require double equal for null and undefined, triple equal everywhere else
"@foxglove/strict-equality": "error",
"@foxglove/no-return-promise-resolve": "error",
"@foxglove/prefer-hash-private": "error",

// require curly braces everywhere
curly: "error",
Expand Down
10 changes: 9 additions & 1 deletion configs/typescript.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

void (async () => {
await 1; // eslint-disable-line @typescript-eslint/await-thenable
await (function () {})(); // eslint-disable-line @typescript-eslint/await-thenable, @typescript-eslint/no-empty-function
await (function () {})(); // eslint-disable-line @typescript-eslint/await-thenable, @typescript-eslint/no-empty-function, @typescript-eslint/no-confusing-void-expression
await (async function () {})(); // eslint-disable-line @typescript-eslint/no-empty-function
})();

Expand Down Expand Up @@ -34,5 +34,13 @@ void undefined; // eslint-disable-line @typescript-eslint/no-meaningless-void-op
42; // eslint-disable-line @typescript-eslint/no-unused-expressions
<></>; // eslint-disable-line @typescript-eslint/no-unused-expressions

class C {
private x = 1; // eslint-disable-line @foxglove/prefer-hash-private
constructor() {
void this.x;
}
}
void C;

// keep isolatedModules happy
export default {};
26 changes: 17 additions & 9 deletions configs/typescript.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
module.exports = {
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
rules: {
// Avoid #member syntax for performance
"@foxglove/no-private-identifier": "error",
"@typescript-eslint/no-meaningless-void-operator": [
"error",
{ checkNever: true },
Expand Down Expand Up @@ -52,16 +50,11 @@ module.exports = {
],

"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/promise-function-async": "error",

// Async functions without await are used to satisfy interface requirements
"@typescript-eslint/require-await": "off",

// both sides of `+` must be either string or number
"@typescript-eslint/restrict-plus-operands": "error",

"@typescript-eslint/return-await": ["error", "always"],

// require all cases to be checked in switch statements
Expand All @@ -81,5 +74,20 @@ module.exports = {
allowAny: false,
},
],

"@typescript-eslint/prefer-nullish-coalescing": [
"error",
{ ignoreConditionalTests: true },
],

// We find the following rules from the strict/stylistic configs to be overly pedantic and not
// so useful
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/consistent-indexed-object-style": "off",
"@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/unified-signatures": "off",
},
};
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = {
rules: {
"license-header": require("./rules/license-header"),
"no-private-identifier": require("./rules/no-private-identifier"),
"strict-equality": require("./rules/strict-equality"),
"no-return-promise-resolve": require("./rules/no-return-promise-resolve"),
"no-boolean-parameters": require("./rules/no-boolean-parameters"),
Expand Down
Loading
Loading