Skip to content

Commit 26c0602

Browse files
Enable additional lint rules (#3268)
1 parent 070e092 commit 26c0602

152 files changed

Lines changed: 557 additions & 490 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.meta-updater/main.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import { updater } from "../packages/tool-meta-updater/src/index.ts";
22

3+
// oxlint-disable-next-line import/no-default-export
34
export default updater;

‎oxlint.config.mts‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@ import type { OxlintConfig } from "oxlint";
22
import { defineConfig } from "oxlint";
33

44
// These rules should probably be re-enabled eventually
5-
const temporarilyDisabled = [
6-
"eslint/no-param-reassign",
7-
"eslint/no-shadow",
8-
"eslint/prefer-template",
9-
"import/no-default-export",
10-
"typescript/no-unsafe-type-assertion",
11-
"unicorn/no-array-reduce",
5+
const temporarilyDisabledRules = [
6+
"unicorn/no-array-for-each",
7+
"unicorn/no-array-reverse",
8+
"unicorn/no-array-sort",
129
];
1310

1411
const disabledRules = [
15-
...temporarilyDisabled,
12+
...temporarilyDisabledRules,
1613
"eslint/arrow-body-style",
1714
"eslint/capitalized-comments",
1815
"eslint/class-methods-use-this",
1916
"eslint/complexity",
20-
"eslint/func-names",
2117
"eslint/id-length",
2218
"eslint/init-declarations",
2319
"eslint/max-classes-per-file",
@@ -30,10 +26,10 @@ const disabledRules = [
3026
"eslint/no-continue",
3127
"eslint/no-eq-null",
3228
"eslint/no-lonely-if",
33-
"eslint/no-loop-func",
3429
"eslint/no-magic-numbers",
3530
"eslint/no-negated-condition",
3631
"eslint/no-plusplus",
32+
"eslint/no-shadow",
3733
"eslint/no-ternary",
3834
"eslint/no-undefined",
3935
"eslint/no-use-before-define",
@@ -61,21 +57,16 @@ const disabledRules = [
6157
"promise/prefer-await-to-callbacks",
6258
"react-perf/jsx-no-new-function-as-prop",
6359
"react/jsx-max-depth",
64-
"react/no-danger",
6560
"react/no-multi-comp",
6661
"react/only-export-components",
6762
"react/react-in-jsx-scope",
68-
"react/rules-of-hooks",
6963
"typescript/explicit-function-return-type",
7064
"typescript/parameter-properties",
7165
"typescript/prefer-readonly-parameter-types",
7266
"typescript/promise-function-async",
7367
"typescript/strict-void-return",
7468
"unicorn/filename-case",
7569
"unicorn/no-array-callback-reference",
76-
"unicorn/no-array-for-each",
77-
"unicorn/no-array-reverse",
78-
"unicorn/no-array-sort",
7970
"unicorn/no-lonely-if",
8071
"unicorn/no-null",
8172
"unicorn/no-object-as-default-parameter",
@@ -194,6 +185,11 @@ export default defineConfig({
194185
},
195186

196187
overrides: [
188+
{
189+
files: ["**/*.{ts,cts,mts,tsx}"],
190+
plugins: [...plugins, "typescript"],
191+
},
192+
197193
{
198194
files: ["**/*.js"],
199195
rules: {
@@ -202,8 +198,17 @@ export default defineConfig({
202198
},
203199

204200
{
205-
files: ["**/*.{ts,cts,mts,tsx}"],
206-
plugins: [...plugins, "typescript"],
201+
files: ["**/*.ts"],
202+
rules: {
203+
"react/rules-of-hooks": "off",
204+
},
205+
},
206+
207+
{
208+
files: ["**/*.test.ts"],
209+
rules: {
210+
"eslint/func-names": "off",
211+
},
207212
},
208213

209214
{

‎packages/app-neovim/src/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { activate } from "./extension";
66
* - Register the functions that are exposed to Neovim.
77
* Note that these function need to start with a capital letter to be callable from Neovim.
88
*/
9+
// oxlint-disable-next-line import/no-default-export
910
export default function entry(plugin: NvimPlugin) {
1011
// We make sure the cursorless-neovim extension is only loaded once,
1112
// as otherwise we will run our first copy when loading the extension

‎packages/app-vscode/src/ReleaseNotes.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const testCases: TestCase[] = [
152152
},
153153
];
154154

155-
suite("release notes", function () {
155+
suite("release notes", () => {
156156
teardown(() => {
157157
sinon.restore();
158158
});

‎packages/app-vscode/src/ScopeTreeProvider.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class ScopeSupportTreeItem extends TreeItem {
329329
getLanguageExtensionSampleFromLanguageId(languageId);
330330
if (fileExtension != null) {
331331
this.resourceUri = URI.parse(
332-
"cursorless-dummy://dummy/dummy" + fileExtension,
332+
`cursorless-dummy://dummy/dummy${fileExtension}`,
333333
);
334334
}
335335
this.setUrl(languageId);

‎packages/app-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighter.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class VscodeFancyRangeHighlighter {
4444
// A single range will be split into multiple decorations if it spans
4545
// multiple lines, so that we can eg use dashed lines to end lines that
4646
// are part of the same range.
47-
function* ({ range, differentiationIndex }) {
47+
function* generateDecorations({ range, differentiationIndex }) {
4848
const iterable =
4949
range.type === "line"
5050
? generateDecorationsForLineRange(range.start, range.end)

‎packages/app-vscode/src/ide/vscode/VscodeClipboard.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from "vscode";
22
import type { Clipboard } from "@cursorless/lib-common";
33

4-
export default class VscodeClipboard implements Clipboard {
4+
export class VscodeClipboard implements Clipboard {
55
async readText(): Promise<string> {
66
return await vscode.env.clipboard.readText();
77
}

‎packages/app-vscode/src/ide/vscode/VscodeConfiguration.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const translators: TranslatorMap = {
2222
},
2323
};
2424

25-
export default class VscodeConfiguration implements Configuration {
25+
export class VscodeConfiguration implements Configuration {
2626
private notifier = new Notifier();
2727

2828
constructor(ide: VscodeIDE) {

‎packages/app-vscode/src/ide/vscode/VscodeEdit.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type * as vscode from "vscode";
22
import type { Edit } from "@cursorless/lib-common";
33
import { toVscodePosition, toVscodeRange } from "@cursorless/lib-vscode-common";
44

5-
export default async function vscodeEdit(
5+
export async function vscodeEdit(
66
editor: vscode.TextEditor,
77
edits: Edit[],
88
): Promise<boolean> {

‎packages/app-vscode/src/ide/vscode/VscodeEnabledHatStyleManager.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type ExtendedHatStyleMap = Partial<
2727
* In VSCode, there is a hat style for every shape-color combination, filtered
2828
* by those whose penalty is not too large.
2929
*/
30-
export default class VscodeEnabledHatStyleManager {
30+
export class VscodeEnabledHatStyleManager {
3131
hatStyleMap!: ExtendedHatStyleMap;
3232
private notifier: Notifier<[HatStyleMap]> = new Notifier();
3333

0 commit comments

Comments
 (0)