Skip to content

Commit 4cea36e

Browse files
committed
chore: use lintCommands
1 parent 0a00737 commit 4cea36e

10 files changed

Lines changed: 90 additions & 104 deletions

File tree

packages/docs/scripts/lint.mts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { $, lintScript } from "complete-node";
1+
import { lintCommands } from "complete-node";
22

3-
await lintScript(import.meta.dirname, async () => {
4-
await Promise.all([
5-
$`tsc --noEmit`,
6-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
7-
$`eslint --max-warnings 0 .`,
8-
]);
9-
});
3+
await lintCommands(import.meta.dirname, [
4+
"tsc --noEmit",
5+
"tsc --noEmit --project ./scripts/tsconfig.json",
6+
"eslint --max-warnings 0 .",
7+
]);
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { $, lintScript } from "complete-node";
1+
import { lintCommands } from "complete-node";
22

3-
await lintScript(import.meta.dirname, async () => {
4-
await Promise.all([
5-
$`tsc --noEmit`,
6-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
7-
$`eslint --max-warnings 0 .`,
8-
]);
9-
});
3+
await lintCommands(import.meta.dirname, [
4+
"tsc --noEmit",
5+
"tsc --noEmit --project ./scripts/tsconfig.json",
6+
"eslint --max-warnings 0 .",
7+
]);

packages/eslint-plugin-isaacscript/scripts/lint.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { assertDefined } from "complete-common";
2-
import { $, echo, exit, lintScript, readFile } from "complete-node";
2+
import { echo, exit, lintCommands, readFile } from "complete-node";
33
import path from "node:path";
44
import { generateAll } from "./generate.js";
55
import { CONFIGS_DIRECTORY_PATH } from "./generateConfigs.js";
@@ -15,18 +15,16 @@ const FILE_PATHS_TOUCHED_BY_GENERATE_SCRIPT = [
1515
README_MD_PATH,
1616
] as const;
1717

18-
await lintScript(import.meta.dirname, async () => {
19-
await Promise.all([
20-
$`tsc --noEmit`,
21-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
22-
$`tsc --noEmit --project ./tests/tsconfig.json`,
23-
$`eslint --max-warnings 0 .`,
24-
]);
18+
await lintCommands(import.meta.dirname, [
19+
"tsc --noEmit",
20+
"tsc --noEmit --project ./scripts/tsconfig.json",
21+
"tsc --noEmit --project ./tests/tsconfig.json",
22+
"eslint --max-warnings 0 .",
23+
]);
2524

26-
// We cannot do generation at the same time as the other linting because it changes the
27-
// compilation output, creating a race condition.
28-
await checkGenerateChangedFiles();
29-
});
25+
// We cannot do generation at the same time as the other linting because it changes the compilation
26+
// output, creating a race condition.
27+
await checkGenerateChangedFiles();
3028

3129
async function checkGenerateChangedFiles() {
3230
const fileContentsMap = new Map<string, string>();
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { $, lintScript } from "complete-node";
1+
import { lintCommands } from "complete-node";
22

3-
await lintScript(import.meta.dirname, async () => {
4-
await Promise.all([
5-
$`tsc --noEmit`,
6-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
7-
$`eslint --max-warnings 0 .`,
8-
]);
9-
});
3+
await lintCommands(import.meta.dirname, [
4+
"tsc --noEmit",
5+
"tsc --noEmit --project ./scripts/tsconfig.json",
6+
"eslint --max-warnings 0 .",
7+
]);
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { $, lintScript } from "complete-node";
1+
import { lintCommands } from "complete-node";
22

3-
await lintScript(import.meta.dirname, async () => {
4-
await Promise.all([
5-
$`tsc --noEmit`,
6-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
7-
$`eslint --max-warnings 0 .`,
8-
]);
9-
});
3+
await lintCommands(import.meta.dirname, [
4+
"tsc --noEmit",
5+
"tsc --noEmit --project ./scripts/tsconfig.json",
6+
"eslint --max-warnings 0 .",
7+
]);
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { $, lintScript } from "complete-node";
1+
import { lintCommands } from "complete-node";
22

3-
await lintScript(import.meta.dirname, async () => {
4-
await Promise.all([
5-
$`tsc --noEmit`,
6-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
7-
$`eslint --max-warnings 0 .`,
8-
]);
9-
});
3+
await lintCommands(import.meta.dirname, [
4+
"tsc --noEmit",
5+
"tsc --noEmit --project ./scripts/tsconfig.json",
6+
"eslint --max-warnings 0 .",
7+
]);

packages/isaacscript-cli/scripts/lint.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import chalk from "chalk";
2-
import { $, diff, echo, exit, lintScript, readFile } from "complete-node";
2+
import { $, diff, echo, exit, lintCommands, readFile } from "complete-node";
33
import path from "node:path";
44

55
const PACKAGE_ROOT = path.resolve(import.meta.dirname, "..");
@@ -12,17 +12,16 @@ const LOCAL_GITIGNORE_PATH = path.join(
1212
const GITIGNORE_URL =
1313
"https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore";
1414

15-
await lintScript(import.meta.dirname, async () => {
16-
await $`pip install isaac-xml-validator --upgrade --quiet`;
15+
await $`pip install isaac-xml-validator --upgrade --quiet`;
1716

18-
await Promise.all([
19-
$`tsc --noEmit`,
20-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
21-
$`eslint --max-warnings 0 .`,
22-
$`isaac-xml-validator --quiet`,
23-
checkGitIgnoreUpdates(),
24-
]);
25-
});
17+
await lintCommands(import.meta.dirname, [
18+
"tsc --noEmit",
19+
"tsc --noEmit --project ./scripts/tsconfig.json",
20+
"eslint --max-warnings 0 .",
21+
"isaac-xml-validator --quiet",
22+
// eslint-disable-next-line unicorn/prefer-top-level-await
23+
["checkGitIgnoreUpdates", checkGitIgnoreUpdates()],
24+
]);
2625

2726
async function checkGitIgnoreUpdates() {
2827
const localGitIgnore = await readFile(LOCAL_GITIGNORE_PATH);
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { $, lintScript } from "complete-node";
1+
import { lintCommands } from "complete-node";
22

3-
await lintScript(import.meta.dirname, async () => {
4-
await Promise.all([
5-
$`tsc --noEmit`,
6-
$`tsc --noEmit --project ./scripts/tsconfig.json`,
7-
$`eslint --max-warnings 0 .`,
8-
]);
9-
});
3+
await lintCommands(import.meta.dirname, [
4+
"tsc --noEmit",
5+
"tsc --noEmit --project ./scripts/tsconfig.json",
6+
"eslint --max-warnings 0 .",
7+
]);

packages/isaacscript-spell/scripts/lint.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import { sortCaseInsensitive } from "complete-common";
22
import {
3-
$,
43
diff,
54
echo,
65
exit,
76
getFileNamesInDirectory,
87
isDirectory,
9-
lintScript,
8+
lintCommands,
109
readFile,
1110
} from "complete-node";
1211
import path from "node:path";
1312

14-
await lintScript(import.meta.dirname, async (packageRoot) => {
15-
await Promise.all([
16-
$`tsc --noEmit`,
17-
$`eslint --max-warnings 0 .`,
18-
checkDictionaries(packageRoot),
19-
]);
20-
});
13+
const PACKAGE_ROOT = path.resolve(import.meta.dirname, "..");
14+
15+
await lintCommands(import.meta.dirname, [
16+
"tsc --noEmit",
17+
"eslint --max-warnings 0 .",
18+
// eslint-disable-next-line unicorn/prefer-top-level-await
19+
["checkDictionaries", checkDictionaries(PACKAGE_ROOT)],
20+
]);
2121

2222
async function checkDictionaries(packageRoot: string) {
2323
const dictionariesPath = path.join(packageRoot, "dictionaries");

scripts/lint.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
import { $, lintMonorepoPackageJSONs, lintScript } from "complete-node";
1+
import { lintCommands, lintMonorepoPackageJSONs } from "complete-node";
2+
import path from "node:path";
23

3-
await lintScript(import.meta.dirname, async (packageRoot) => {
4-
await Promise.all([
5-
// Use TypeScript to type-check the code.
6-
$`tsc --noEmit`,
4+
const MONOREPO_ROOT = path.resolve(import.meta.dirname, "..");
75

8-
// Use ESLint to lint the TypeScript code.
9-
// - "--max-warnings 0" makes warnings fail, since we set all ESLint errors to warnings.
10-
$`eslint --max-warnings 0 scripts *.mjs`, // We have to exclude the packages directory.
6+
await lintCommands(import.meta.dirname, [
7+
// Use TypeScript to type-check the code.
8+
"tsc --noEmit",
119

12-
// Use Prettier to check formatting.
13-
// - "--log-level=warn" makes it only output errors.
14-
$`prettier --log-level=warn --check .`,
10+
// Use ESLint to lint the TypeScript code.
11+
// - "--max-warnings 0" makes warnings fail, since we set all ESLint errors to warnings.
12+
"eslint --max-warnings 0 scripts *.mjs", // We have to exclude the packages directory.
1513

16-
// Use Knip to check for unused files, exports, and dependencies.
17-
$`knip --no-progress`,
14+
// Use Prettier to check formatting.
15+
// - "--log-level=warn" makes it only output errors.
16+
"prettier --log-level=warn --check .",
1817

19-
// Use CSpell to spell check every file.
20-
// - "--no-progress" and "--no-summary" make it only output errors.
21-
$`cspell --no-progress --no-summary .`,
18+
// Use Knip to check for unused files, exports, and dependencies.
19+
"knip --no-progress",
2220

23-
// Check for unused words in the CSpell configuration file.
24-
$`cspell-check-unused-words`,
21+
// Use CSpell to spell check every file.
22+
// - "--no-progress" and "--no-summary" make it only output errors.
23+
"cspell --no-progress --no-summary .",
2524

26-
// Check for template updates.
27-
$`tsx ./packages/isaacscript-cli/src/main.ts check --ignore bundleEntry.ts,ci.yml,eslint.config.mjs,lint.ts,tsconfig.json`,
25+
// Check for unused words in the CSpell configuration file.
26+
"cspell-check-unused-words",
2827

29-
// Check to see if the child "package.json" files are up to date.
30-
lintMonorepoPackageJSONs(packageRoot),
31-
]);
32-
});
28+
// Check for template updates.
29+
"tsx ./packages/isaacscript-cli/src/main.ts check --ignore bundleEntry.ts,ci.yml,eslint.config.mjs,lint.ts,tsconfig.json",
30+
31+
// Check to see if the child "package.json" files are up to date.
32+
["lintMonorepoPackageJSONs", lintMonorepoPackageJSONs(MONOREPO_ROOT)],
33+
]);

0 commit comments

Comments
 (0)