Skip to content

Commit 2a8436c

Browse files
authored
Use eslint-plugin-simple-import-sort (#52090)
1 parent 0d251ba commit 2a8436c

File tree

145 files changed

+515
-475
lines changed

Some content is hidden

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

145 files changed

+515
-475
lines changed

.eslintrc.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"es6": true
1212
},
1313
"plugins": [
14-
"@typescript-eslint", "no-null", "import", "eslint-plugin-local"
14+
"@typescript-eslint", "no-null", "import", "eslint-plugin-local", "simple-import-sort"
1515
],
1616
"ignorePatterns": [
1717
"**/node_modules/**",
@@ -25,11 +25,8 @@
2525
"/coverage/**"
2626
],
2727
"rules": {
28-
"sort-imports": ["error", {
29-
"ignoreCase": true,
30-
"ignoreDeclarationSort": true,
31-
"allowSeparatedGroups": true
32-
}],
28+
"simple-import-sort/imports": "error",
29+
"simple-import-sort/exports": "error",
3330

3431
"@typescript-eslint/adjacent-overload-signatures": "error",
3532
"@typescript-eslint/array-type": "error",
@@ -180,6 +177,14 @@
180177
{ "name": "exports" }
181178
]
182179
}
180+
},
181+
{
182+
// These files contain imports in a specific order that are generally unsafe to modify.
183+
"files": ["**/_namespaces/**"],
184+
"rules": {
185+
"simple-import-sort/imports": "off",
186+
"simple-import-sort/exports": "off"
187+
}
183188
}
184189
]
185190
}

.vscode/settings.template.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
// ".git-blame-ignore-revs"
1414
// ]
1515

16+
// Match eslint-plugin-simple-import-sort in organize/auto-imports.
17+
"typescript.unstable": {
18+
"organizeImportsCollation": "unicode",
19+
"organizeImportsCaseFirst": "upper",
20+
"organizeImportsIgnoreCase": false,
21+
"organizeImportsNumericCollation": true
22+
},
23+
1624
// These options search the repo recursively and slow down
1725
// the build task menu. We define our own in tasks.json.
1826
"typescript.tsc.autoDetect": "off",

Herebyfile.mjs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
// @ts-check
2-
import path from "path";
3-
import fs from "fs";
2+
import { CancelToken } from "@esfx/canceltoken";
3+
import chalk from "chalk";
4+
import chokidar from "chokidar";
45
import del from "del";
5-
import { task } from "hereby";
6+
import esbuild from "esbuild";
7+
import { EventEmitter } from "events";
8+
import fs from "fs";
9+
import fsExtra from "fs-extra";
610
import _glob from "glob";
11+
import { task } from "hereby";
12+
import path from "path";
713
import util from "util";
8-
import chalk from "chalk";
9-
import fsExtra from "fs-extra";
10-
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
11-
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
12-
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
14+
1315
import { localizationDirectories } from "./scripts/build/localization.mjs";
1416
import cmdLineOptions from "./scripts/build/options.mjs";
15-
import esbuild from "esbuild";
16-
import chokidar from "chokidar";
17-
import { EventEmitter } from "events";
18-
import { CancelToken } from "@esfx/canceltoken";
17+
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
18+
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
19+
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
1920

2021
const glob = util.promisify(_glob);
2122

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"eslint-plugin-import": "^2.26.0",
6767
"eslint-plugin-local": "^1.0.0",
6868
"eslint-plugin-no-null": "^1.0.2",
69+
"eslint-plugin-simple-import-sort": "^10.0.0",
6970
"fast-xml-parser": "^4.0.11",
7071
"fs-extra": "^9.1.0",
7172
"glob": "latest",

scripts/browserIntegrationTest.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import chalk from "chalk";
2-
import { join } from "path";
32
import { readFileSync } from "fs";
3+
import { join } from "path";
44

55
let playwright;
66
try {

scripts/build/findUpDir.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { dirname, join, resolve } from "path";
21
import { existsSync } from "fs";
2+
import { dirname, join, resolve } from "path";
33
import url from "url";
44

55
const __filename = url.fileURLToPath(new URL(import.meta.url));

scripts/build/projects.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Debouncer, exec } from "./utils.mjs";
21
import { resolve } from "path";
2+
33
import { findUpRoot } from "./findUpDir.mjs";
44
import cmdLineOptions from "./options.mjs";
5+
import { Debouncer, exec } from "./utils.mjs";
56

67
class ProjectQueue {
78
/**

scripts/build/tests.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import { CancelError } from "@esfx/canceltoken";
2+
import chalk from "chalk";
13
import del from "del";
24
import fs from "fs";
35
import os from "os";
46
import path from "path";
5-
import chalk from "chalk";
7+
8+
import { findUpFile, findUpRoot } from "./findUpDir.mjs";
69
import cmdLineOptions from "./options.mjs";
710
import { exec } from "./utils.mjs";
8-
import { findUpFile, findUpRoot } from "./findUpDir.mjs";
9-
import { CancelError } from "@esfx/canceltoken";
1011

1112
const mochaJs = path.resolve(findUpRoot(), "node_modules", "mocha", "bin", "_mocha");
1213
export const localBaseline = "tests/baselines/local/";

scripts/build/utils.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* eslint-disable no-restricted-globals */
22

3-
import fs from "fs";
4-
import path from "path";
3+
import { CancelError } from "@esfx/canceltoken";
4+
import assert from "assert";
55
import chalk from "chalk";
6-
import which from "which";
76
import { spawn } from "child_process";
8-
import assert from "assert";
7+
import fs from "fs";
98
import JSONC from "jsonc-parser";
10-
import { CancelError } from "@esfx/canceltoken";
9+
import path from "path";
10+
import which from "which";
1111

1212
/**
1313
* Executes the provided command once with the supplied arguments.

0 commit comments

Comments
 (0)