Skip to content

Commit 1af9d5f

Browse files
refactor: replace build tools glob with build configs
1 parent 51e0418 commit 1af9d5f

7 files changed

Lines changed: 23 additions & 127 deletions

File tree

src/eslint/configs/disables.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
GLOB_BIN,
3-
GLOB_BUILD_TOOLS,
3+
GLOB_BUILD_CONFIGS,
44
GLOB_DTS,
55
GLOB_JSX,
66
GLOB_SRC,
@@ -43,7 +43,7 @@ export function disables({
4343
{
4444
name: "isentinel/disables/scripts",
4545
basePath: workspaceRoot,
46-
files: [`**/scripts/${GLOB_SRC}`],
46+
files: [`**/scripts/${GLOB_SRC}`, "**/.github/scripts/**/*"],
4747
rules: {
4848
"antfu/no-top-level-await": "off",
4949
"max-lines": "off",
@@ -62,9 +62,9 @@ export function disables({
6262
},
6363
},
6464
{
65-
name: "isentinel/disables/build-tools",
65+
name: "isentinel/disables/build-configs",
6666
basePath: workspaceRoot,
67-
files: GLOB_BUILD_TOOLS,
67+
files: GLOB_BUILD_CONFIGS,
6868
rules: {
6969
"antfu/no-top-level-await": "off",
7070
"no-console": "off",

src/globs.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,11 @@ export const GLOB_TESTS: Array<string> = [
118118
`**/*.benchmark.${GLOB_SRC_EXT}`,
119119
];
120120

121-
export const GLOB_BUILD_TOOLS: Array<string> = [
121+
export const GLOB_BUILD_CONFIGS: Array<string> = [
122122
"**/.husky/**/*",
123123
`**/config/${GLOB_SRC}`,
124124
`**/*config.${GLOB_SRC_EXT}`,
125125
`**/*config.*.${GLOB_SRC_EXT}`,
126-
`**/build/${GLOB_SRC}`,
127-
`**/tools/${GLOB_SRC}`,
128-
`**/setup/${GLOB_SRC}`,
129-
`**/dev/${GLOB_SRC}`,
130-
`**/tasks/${GLOB_SRC}`,
131-
"**/.github/scripts/**/*",
132126
];
133127

134128
export const GLOB_ALL_SRC = [

src/oxlint/configs/disables.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { rebaseAncestorAnchor, workspaceRelativeDirectory } from "../../anchors.ts";
22
import {
3-
GLOB_BUILD_TOOLS,
3+
GLOB_BUILD_CONFIGS,
44
GLOB_DTS,
55
GLOB_JSX,
66
GLOB_SRC,
@@ -58,8 +58,8 @@ export function oxlintDisables({
5858
},
5959
}),
6060
...createOxlintConfigs({
61-
name: "isentinel/disables/build-tools",
62-
files: GLOB_BUILD_TOOLS,
61+
name: "isentinel/disables/build-configs",
62+
files: GLOB_BUILD_CONFIGS,
6363
rules: {
6464
"antfu/no-top-level-await": "off",
6565
"no-console": "off",

src/oxlint/configs/imports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GLOB_BIN, GLOB_BUILD_TOOLS, GLOB_DTS, GLOB_SRC } from "../../globs.ts";
1+
import { GLOB_BIN, GLOB_BUILD_CONFIGS, GLOB_DTS, GLOB_SRC } from "../../globs.ts";
22
import { importsRules } from "../../rules/imports.ts";
33
import type { OptionsHasRoblox, OptionsStylistic } from "../../types.ts";
44
import type { OxlintRules, TypedOxlintConfigItem } from "../types.ts";
@@ -66,7 +66,7 @@ export function oxlintImports({
6666
},
6767
{
6868
name: "isentinel/imports/oxlint/default-export",
69-
excludeFiles: [GLOB_DTS, ...GLOB_BUILD_TOOLS, ...exclude],
69+
excludeFiles: [GLOB_DTS, ...GLOB_BUILD_CONFIGS, ...exclude],
7070
files: [GLOB_SRC],
7171
plugins: ["import"],
7272
rules: {

test/__snapshots__/eslint-snapshot.spec.ts.snap

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,7 @@ exports[`config snapshots > 'minimal' > should match the config snapshot 1`] = `
11511151
{
11521152
"files": [
11531153
"**/scripts/**/*.{,c,m}[jt]s{,x}",
1154+
"**/.github/scripts/**/*",
11541155
],
11551156
"name": "isentinel/disables/scripts",
11561157
"rules": [
@@ -1178,14 +1179,8 @@ exports[`config snapshots > 'minimal' > should match the config snapshot 1`] = `
11781179
"**/config/**/*.{,c,m}[jt]s{,x}",
11791180
"**/*config.{,c,m}[jt]s{,x}",
11801181
"**/*config.*.{,c,m}[jt]s{,x}",
1181-
"**/build/**/*.{,c,m}[jt]s{,x}",
1182-
"**/tools/**/*.{,c,m}[jt]s{,x}",
1183-
"**/setup/**/*.{,c,m}[jt]s{,x}",
1184-
"**/dev/**/*.{,c,m}[jt]s{,x}",
1185-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
1186-
"**/.github/scripts/**/*",
11871182
],
1188-
"name": "isentinel/disables/build-tools",
1183+
"name": "isentinel/disables/build-configs",
11891184
"rules": [
11901185
"-antfu/no-top-level-await",
11911186
"-no-console",
@@ -2842,6 +2837,7 @@ exports[`config snapshots > 'package' > should match the config snapshot 1`] = `
28422837
{
28432838
"files": [
28442839
"**/scripts/**/*.{,c,m}[jt]s{,x}",
2840+
"**/.github/scripts/**/*",
28452841
],
28462842
"name": "isentinel/disables/scripts",
28472843
"rules": [
@@ -2869,14 +2865,8 @@ exports[`config snapshots > 'package' > should match the config snapshot 1`] = `
28692865
"**/config/**/*.{,c,m}[jt]s{,x}",
28702866
"**/*config.{,c,m}[jt]s{,x}",
28712867
"**/*config.*.{,c,m}[jt]s{,x}",
2872-
"**/build/**/*.{,c,m}[jt]s{,x}",
2873-
"**/tools/**/*.{,c,m}[jt]s{,x}",
2874-
"**/setup/**/*.{,c,m}[jt]s{,x}",
2875-
"**/dev/**/*.{,c,m}[jt]s{,x}",
2876-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
2877-
"**/.github/scripts/**/*",
28782868
],
2879-
"name": "isentinel/disables/build-tools",
2869+
"name": "isentinel/disables/build-configs",
28802870
"rules": [
28812871
"-antfu/no-top-level-await",
28822872
"-no-console",
@@ -5297,6 +5287,7 @@ exports[`config snapshots > 'roblox-game' > should match the config snapshot 1`]
52975287
{
52985288
"files": [
52995289
"**/scripts/**/*.{,c,m}[jt]s{,x}",
5290+
"**/.github/scripts/**/*",
53005291
],
53015292
"name": "isentinel/disables/scripts",
53025293
"rules": [
@@ -5324,14 +5315,8 @@ exports[`config snapshots > 'roblox-game' > should match the config snapshot 1`]
53245315
"**/config/**/*.{,c,m}[jt]s{,x}",
53255316
"**/*config.{,c,m}[jt]s{,x}",
53265317
"**/*config.*.{,c,m}[jt]s{,x}",
5327-
"**/build/**/*.{,c,m}[jt]s{,x}",
5328-
"**/tools/**/*.{,c,m}[jt]s{,x}",
5329-
"**/setup/**/*.{,c,m}[jt]s{,x}",
5330-
"**/dev/**/*.{,c,m}[jt]s{,x}",
5331-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
5332-
"**/.github/scripts/**/*",
53335318
],
5334-
"name": "isentinel/disables/build-tools",
5319+
"name": "isentinel/disables/build-configs",
53355320
"rules": [
53365321
"-antfu/no-top-level-await",
53375322
"-no-console",
@@ -8170,6 +8155,7 @@ exports[`config snapshots > 'scoped-roblox' > should match the config snapshot 1
81708155
{
81718156
"files": [
81728157
"**/scripts/**/*.{,c,m}[jt]s{,x}",
8158+
"**/.github/scripts/**/*",
81738159
],
81748160
"name": "isentinel/disables/scripts",
81758161
"rules": [
@@ -8197,14 +8183,8 @@ exports[`config snapshots > 'scoped-roblox' > should match the config snapshot 1
81978183
"**/config/**/*.{,c,m}[jt]s{,x}",
81988184
"**/*config.{,c,m}[jt]s{,x}",
81998185
"**/*config.*.{,c,m}[jt]s{,x}",
8200-
"**/build/**/*.{,c,m}[jt]s{,x}",
8201-
"**/tools/**/*.{,c,m}[jt]s{,x}",
8202-
"**/setup/**/*.{,c,m}[jt]s{,x}",
8203-
"**/dev/**/*.{,c,m}[jt]s{,x}",
8204-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
8205-
"**/.github/scripts/**/*",
82068186
],
8207-
"name": "isentinel/disables/build-tools",
8187+
"name": "isentinel/disables/build-configs",
82088188
"rules": [
82098189
"-antfu/no-top-level-await",
82108190
"-no-console",

test/__snapshots__/oxlint.spec.ts.snap

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,12 +1780,6 @@ exports[`oxlint config snapshots > 'minimal' > should match the config snapshot
17801780
"**/config/**/*.{,c,m}[jt]s{,x}",
17811781
"**/*config.{,c,m}[jt]s{,x}",
17821782
"**/*config.*.{,c,m}[jt]s{,x}",
1783-
"**/build/**/*.{,c,m}[jt]s{,x}",
1784-
"**/tools/**/*.{,c,m}[jt]s{,x}",
1785-
"**/setup/**/*.{,c,m}[jt]s{,x}",
1786-
"**/dev/**/*.{,c,m}[jt]s{,x}",
1787-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
1788-
"**/.github/scripts/**/*",
17891783
],
17901784
"files": [
17911785
"**/*.{,c,m}[jt]s{,x}",
@@ -2576,12 +2570,6 @@ exports[`oxlint config snapshots > 'minimal' > should match the config snapshot
25762570
"**/config/**/*.{,c,m}[jt]s{,x}",
25772571
"**/*config.{,c,m}[jt]s{,x}",
25782572
"**/*config.*.{,c,m}[jt]s{,x}",
2579-
"**/build/**/*.{,c,m}[jt]s{,x}",
2580-
"**/tools/**/*.{,c,m}[jt]s{,x}",
2581-
"**/setup/**/*.{,c,m}[jt]s{,x}",
2582-
"**/dev/**/*.{,c,m}[jt]s{,x}",
2583-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
2584-
"**/.github/scripts/**/*",
25852573
],
25862574
"rules": {
25872575
"no-console": "off",
@@ -2594,12 +2582,6 @@ exports[`oxlint config snapshots > 'minimal' > should match the config snapshot
25942582
"**/config/**/*.{,c,m}[jt]s{,x}",
25952583
"**/*config.{,c,m}[jt]s{,x}",
25962584
"**/*config.*.{,c,m}[jt]s{,x}",
2597-
"**/build/**/*.{,c,m}[jt]s{,x}",
2598-
"**/tools/**/*.{,c,m}[jt]s{,x}",
2599-
"**/setup/**/*.{,c,m}[jt]s{,x}",
2600-
"**/dev/**/*.{,c,m}[jt]s{,x}",
2601-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
2602-
"**/.github/scripts/**/*",
26032585
],
26042586
"jsPlugins": [
26052587
{
@@ -4697,12 +4679,6 @@ exports[`oxlint config snapshots > 'package' > should match the config snapshot
46974679
"**/config/**/*.{,c,m}[jt]s{,x}",
46984680
"**/*config.{,c,m}[jt]s{,x}",
46994681
"**/*config.*.{,c,m}[jt]s{,x}",
4700-
"**/build/**/*.{,c,m}[jt]s{,x}",
4701-
"**/tools/**/*.{,c,m}[jt]s{,x}",
4702-
"**/setup/**/*.{,c,m}[jt]s{,x}",
4703-
"**/dev/**/*.{,c,m}[jt]s{,x}",
4704-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
4705-
"**/.github/scripts/**/*",
47064682
],
47074683
"files": [
47084684
"**/*.{,c,m}[jt]s{,x}",
@@ -6547,12 +6523,6 @@ exports[`oxlint config snapshots > 'package' > should match the config snapshot
65476523
"**/config/**/*.{,c,m}[jt]s{,x}",
65486524
"**/*config.{,c,m}[jt]s{,x}",
65496525
"**/*config.*.{,c,m}[jt]s{,x}",
6550-
"**/build/**/*.{,c,m}[jt]s{,x}",
6551-
"**/tools/**/*.{,c,m}[jt]s{,x}",
6552-
"**/setup/**/*.{,c,m}[jt]s{,x}",
6553-
"**/dev/**/*.{,c,m}[jt]s{,x}",
6554-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
6555-
"**/.github/scripts/**/*",
65566526
],
65576527
"rules": {
65586528
"no-console": "off",
@@ -6565,12 +6535,6 @@ exports[`oxlint config snapshots > 'package' > should match the config snapshot
65656535
"**/config/**/*.{,c,m}[jt]s{,x}",
65666536
"**/*config.{,c,m}[jt]s{,x}",
65676537
"**/*config.*.{,c,m}[jt]s{,x}",
6568-
"**/build/**/*.{,c,m}[jt]s{,x}",
6569-
"**/tools/**/*.{,c,m}[jt]s{,x}",
6570-
"**/setup/**/*.{,c,m}[jt]s{,x}",
6571-
"**/dev/**/*.{,c,m}[jt]s{,x}",
6572-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
6573-
"**/.github/scripts/**/*",
65746538
],
65756539
"jsPlugins": [
65766540
{
@@ -8990,12 +8954,6 @@ exports[`oxlint config snapshots > 'roblox-game' > should match the config snaps
89908954
"**/config/**/*.{,c,m}[jt]s{,x}",
89918955
"**/*config.{,c,m}[jt]s{,x}",
89928956
"**/*config.*.{,c,m}[jt]s{,x}",
8993-
"**/build/**/*.{,c,m}[jt]s{,x}",
8994-
"**/tools/**/*.{,c,m}[jt]s{,x}",
8995-
"**/setup/**/*.{,c,m}[jt]s{,x}",
8996-
"**/dev/**/*.{,c,m}[jt]s{,x}",
8997-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
8998-
"**/.github/scripts/**/*",
89998957
],
90008958
"files": [
90018959
"**/*.{,c,m}[jt]s{,x}",
@@ -10610,12 +10568,6 @@ exports[`oxlint config snapshots > 'roblox-game' > should match the config snaps
1061010568
"**/config/**/*.{,c,m}[jt]s{,x}",
1061110569
"**/*config.{,c,m}[jt]s{,x}",
1061210570
"**/*config.*.{,c,m}[jt]s{,x}",
10613-
"**/build/**/*.{,c,m}[jt]s{,x}",
10614-
"**/tools/**/*.{,c,m}[jt]s{,x}",
10615-
"**/setup/**/*.{,c,m}[jt]s{,x}",
10616-
"**/dev/**/*.{,c,m}[jt]s{,x}",
10617-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
10618-
"**/.github/scripts/**/*",
1061910571
],
1062010572
"rules": {
1062110573
"no-console": "off",
@@ -10628,12 +10580,6 @@ exports[`oxlint config snapshots > 'roblox-game' > should match the config snaps
1062810580
"**/config/**/*.{,c,m}[jt]s{,x}",
1062910581
"**/*config.{,c,m}[jt]s{,x}",
1063010582
"**/*config.*.{,c,m}[jt]s{,x}",
10631-
"**/build/**/*.{,c,m}[jt]s{,x}",
10632-
"**/tools/**/*.{,c,m}[jt]s{,x}",
10633-
"**/setup/**/*.{,c,m}[jt]s{,x}",
10634-
"**/dev/**/*.{,c,m}[jt]s{,x}",
10635-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
10636-
"**/.github/scripts/**/*",
1063710583
],
1063810584
"jsPlugins": [
1063910585
{
@@ -13056,12 +13002,6 @@ exports[`oxlint config snapshots > 'scoped-roblox' > should match the config sna
1305613002
"**/config/**/*.{,c,m}[jt]s{,x}",
1305713003
"**/*config.{,c,m}[jt]s{,x}",
1305813004
"**/*config.*.{,c,m}[jt]s{,x}",
13059-
"**/build/**/*.{,c,m}[jt]s{,x}",
13060-
"**/tools/**/*.{,c,m}[jt]s{,x}",
13061-
"**/setup/**/*.{,c,m}[jt]s{,x}",
13062-
"**/dev/**/*.{,c,m}[jt]s{,x}",
13063-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
13064-
"**/.github/scripts/**/*",
1306513005
],
1306613006
"files": [
1306713007
"**/*.{,c,m}[jt]s{,x}",
@@ -15963,12 +15903,6 @@ exports[`oxlint config snapshots > 'scoped-roblox' > should match the config sna
1596315903
"**/config/**/*.{,c,m}[jt]s{,x}",
1596415904
"**/*config.{,c,m}[jt]s{,x}",
1596515905
"**/*config.*.{,c,m}[jt]s{,x}",
15966-
"**/build/**/*.{,c,m}[jt]s{,x}",
15967-
"**/tools/**/*.{,c,m}[jt]s{,x}",
15968-
"**/setup/**/*.{,c,m}[jt]s{,x}",
15969-
"**/dev/**/*.{,c,m}[jt]s{,x}",
15970-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
15971-
"**/.github/scripts/**/*",
1597215906
"src/**",
1597315907
],
1597415908
"files": [
@@ -17058,12 +16992,6 @@ exports[`oxlint config snapshots > 'scoped-roblox' > should match the config sna
1705816992
"**/config/**/*.{,c,m}[jt]s{,x}",
1705916993
"**/*config.{,c,m}[jt]s{,x}",
1706016994
"**/*config.*.{,c,m}[jt]s{,x}",
17061-
"**/build/**/*.{,c,m}[jt]s{,x}",
17062-
"**/tools/**/*.{,c,m}[jt]s{,x}",
17063-
"**/setup/**/*.{,c,m}[jt]s{,x}",
17064-
"**/dev/**/*.{,c,m}[jt]s{,x}",
17065-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
17066-
"**/.github/scripts/**/*",
1706716995
],
1706816996
"rules": {
1706916997
"no-console": "off",
@@ -17076,12 +17004,6 @@ exports[`oxlint config snapshots > 'scoped-roblox' > should match the config sna
1707617004
"**/config/**/*.{,c,m}[jt]s{,x}",
1707717005
"**/*config.{,c,m}[jt]s{,x}",
1707817006
"**/*config.*.{,c,m}[jt]s{,x}",
17079-
"**/build/**/*.{,c,m}[jt]s{,x}",
17080-
"**/tools/**/*.{,c,m}[jt]s{,x}",
17081-
"**/setup/**/*.{,c,m}[jt]s{,x}",
17082-
"**/dev/**/*.{,c,m}[jt]s{,x}",
17083-
"**/tasks/**/*.{,c,m}[jt]s{,x}",
17084-
"**/.github/scripts/**/*",
1708517007
],
1708617008
"jsPlugins": [
1708717009
{

test/anchored-disables.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";
33

44
import { hasAncestorDirectoryAnchor, rebaseAncestorAnchor } from "../src/anchors.ts";
55
import { disables } from "../src/eslint/configs/disables.ts";
6-
import { GLOB_SRC } from "../src/globs.ts";
6+
import { GLOB_BUILD_CONFIGS, GLOB_SRC } from "../src/globs.ts";
77
import { oxlintDisables } from "../src/oxlint/configs/disables.ts";
88

99
const WORKSPACE_ROOT = path.join("D:", "workspace");
@@ -128,7 +128,7 @@ describe("anchored disables stay mitigated", () => {
128128
expect(anchoredEslintBlocks().map((block) => block.name)).toStrictEqual([
129129
"isentinel/disables/scripts",
130130
"isentinel/disables/cli",
131-
"isentinel/disables/build-tools",
131+
"isentinel/disables/build-configs",
132132
"isentinel/disables/bin",
133133
"isentinel/disables/test",
134134
]);
@@ -170,14 +170,14 @@ describe("oxlint anchor rebasing", () => {
170170
expect(files).toContain(GLOB_SRC);
171171
});
172172

173-
it("widens anchored globs from a nested project directory", () => {
173+
it("does not widen unrelated directories", () => {
174174
expect.assertions(1);
175175

176176
const files = oxlintBlocks(path.join(WORKSPACE_ROOT, "tools", "bundler")).get(
177-
"isentinel/disables/build-tools",
177+
"isentinel/disables/build-configs",
178178
);
179179

180-
expect(files).toContain(GLOB_SRC);
180+
expect(files).toStrictEqual(GLOB_BUILD_CONFIGS);
181181
});
182182

183183
it("leaves globs untouched without a configDirectory", () => {

0 commit comments

Comments
 (0)