@genesislcap/eslint-stylelint-builder 15.19.0 → 15.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/eslint-stylelint-builder",
3
3
  "description": "ESLint/Stylelint builder",
4
- "version": "15.19.0",
4
+ "version": "15.19.1",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "lint:fix": "genx lint -l ox --fix"
17
17
  },
18
18
  "dependencies": {
19
- "@genesislcap/build-kit": "15.19.0",
19
+ "@genesislcap/build-kit": "15.19.1",
20
20
  "consola": "^3.0.2",
21
21
  "eslint": "^9.34.0",
22
22
  "oxfmt": "^0.44.0",
@@ -30,6 +30,5 @@
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
- },
34
- "gitHead": "83695de98c2288c2e89992215cb391652f6c5eec"
33
+ }
35
34
  }
package/src/index.ts DELETED
@@ -1,146 +0,0 @@
1
- import os from 'os';
2
- import type { BuildContext } from '@genesislcap/build-kit';
3
- import { run, resolveBin } from '@genesislcap/build-kit';
4
- import consola from 'consola';
5
-
6
- /** ESLint file glob; Oxlint scope is aligned via `OXLINT_CLI_IGNORE_PATTERNS` (extensions + `.genx`). */
7
- const ESLINT_TS_JS_GLOB = '"./**/*.{ts,js,tsx,jsx}"';
8
-
9
- /**
10
- * Oxlint only accepts directory/file PATHs, not ESLint-style brace globs. Lint `.` and ignore other
11
- * extensions Oxlint supports so scope matches `ESLINT_TS_JS_GLOB` (plain `.ts` / `.js` only).
12
- */
13
- /** CLI flags: Oxlint does not reliably apply `ignorePatterns` from extended configs for dot-directories like `.genx`. */
14
- const OXLINT_CLI_IGNORE_PATTERNS = [
15
- '**/.genx/**',
16
- '**/*.mjs',
17
- '**/*.cjs',
18
- '**/*.mts',
19
- '**/*.cts',
20
- '**/*.vue',
21
- '**/*.svelte',
22
- '**/*.astro',
23
- ]
24
- .map((pattern) => ` --ignore-pattern="${pattern}"`)
25
- .join('');
26
-
27
- /**
28
- * TODO: https://github.com/oxc-project/oxc/issues/1117 - Swap `ci` pipeline to `ox` once import/no-extraneous-dependencies lands in oxlint.
29
- */
30
- async function runOxlintStep(cwd: string, oxlintFixArg: string): Promise<void> {
31
- consola.info('Running Oxlint...');
32
- const oxlint = await resolveBin('oxlint');
33
- const oxlintCmd = `${oxlint} .${OXLINT_CLI_IGNORE_PATTERNS}${oxlintFixArg}`;
34
- consola.info(`Executing: ${oxlintCmd}`);
35
- run(cwd, oxlintCmd);
36
- consola.success('Oxlint completed');
37
- }
38
-
39
- async function runEslintStep(
40
- cwd: string,
41
- fixArg: string,
42
- profile: boolean | undefined,
43
- concurrency: string | number | undefined,
44
- disablePrettierNoise = false,
45
- ): Promise<void> {
46
- consola.info('Running ESLint...');
47
- if (profile) {
48
- process.env.TIMING = '1';
49
- }
50
- const eslint = await resolveBin('eslint');
51
- let concurrencyArg = '';
52
- if (concurrency) {
53
- concurrencyArg = ` --concurrency ${concurrency}`;
54
- } else if (!process.env.CI) {
55
- const defaultConcurrency = Math.max(1, Math.floor(os.cpus().length / 2));
56
- concurrencyArg = ` --concurrency ${defaultConcurrency}`;
57
- }
58
- const formattingNoiseArg = disablePrettierNoise
59
- ? [
60
- ' --rule "prettier/prettier: off"',
61
- ' --rule "max-len: off"',
62
- ' --rule "eol-last: off"',
63
- ' --rule "jsx-quotes: off"',
64
- ' --rule "spaced-comment: off"',
65
- ].join('')
66
- : '';
67
- const command = `${eslint} ${ESLINT_TS_JS_GLOB} ${fixArg}${concurrencyArg}${formattingNoiseArg}`;
68
- consola.info(`Executing: ${command}`);
69
- run(cwd, command);
70
- consola.success('ESLint completed');
71
- }
72
-
73
- async function runOxfmtStep(cwd: string, fix: boolean | undefined): Promise<void> {
74
- consola.info('Running Oxfmt...');
75
- const oxfmt = await resolveBin('oxfmt');
76
- const oxfmtCmd = fix ? `${oxfmt} .` : `${oxfmt} --check .`;
77
- consola.info(`Executing: ${oxfmtCmd}`);
78
- run(cwd, oxfmtCmd);
79
- consola.success('Oxfmt completed');
80
- }
81
-
82
- async function runStylelintStep(cwd: string, fixArg: string): Promise<void> {
83
- consola.info('Running Stylelint...');
84
- const stylelint = await resolveBin('stylelint');
85
- run(cwd, `${stylelint} "./**/*.styles.ts" ${fixArg} --allow-empty-input`);
86
- consola.success('Stylelint completed');
87
- }
88
-
89
- export default async (ctx: BuildContext) => {
90
- const {
91
- dirs: { cwd },
92
- cli: {
93
- isLint,
94
- options: { profile, linter, fix, concurrency },
95
- },
96
- } = ctx;
97
- if (isLint) {
98
- const fixArg = fix ? ' --fix' : '';
99
- const oxlintFixArg = fix ? ' --fix' : '';
100
-
101
- // ox pipeline: Oxlint → Oxfmt → Stylelint.
102
- if (linter === 'ox') {
103
- await runOxlintStep(cwd, oxlintFixArg);
104
- await runOxfmtStep(cwd, fix);
105
- await runStylelintStep(cwd, fixArg);
106
- return;
107
- }
108
-
109
- // CI pipeline: Oxlint → ESLint → Oxfmt → Stylelint.
110
- // Keeps ESLint for rules not yet in Oxlint (e.g. import/no-extraneous-dependencies).
111
- // Once Oxlint covers all CI rules, swap to `linter === 'ox'`.
112
- if (linter === 'ci') {
113
- await runOxlintStep(cwd, oxlintFixArg);
114
- await runEslintStep(cwd, fixArg, profile, concurrency, true);
115
- await runOxfmtStep(cwd, fix);
116
- await runStylelintStep(cwd, fixArg);
117
- return;
118
- }
119
-
120
- // Default and `-l all`: ESLint + Prettier + Stylelint (legacy, backward-compatible).
121
- // Use `genx lint -l ox` for the new Oxlint/Oxfmt stack.
122
- const runAll = !linter || linter === 'all';
123
- const runOxfmt = linter === 'oxfmt';
124
- const runOxlint = linter === 'oxlint';
125
- const runEslint = runAll || linter === 'eslint';
126
- const runStylelint = runAll || linter === 'stylelint';
127
-
128
- if (runOxlint) {
129
- await runOxlintStep(cwd, oxlintFixArg);
130
- }
131
-
132
- if (runOxfmt) {
133
- await runOxfmtStep(cwd, fix);
134
- }
135
-
136
- if (runEslint) {
137
- await runEslintStep(cwd, fixArg, profile, concurrency, false);
138
- }
139
-
140
- if (runStylelint) {
141
- await runStylelintStep(cwd, fixArg);
142
- }
143
- } else {
144
- throw new Error(`Unrecognized command: ${JSON.stringify(ctx.cli.options)}`);
145
- }
146
- };
package/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.json",
3
- "compilerOptions": {
4
- "declarationDir": "./dist",
5
- "lib": ["ES2015", "ES2016", "ES2017", "ES2019"],
6
- "module": "commonjs",
7
- "outDir": "./dist",
8
- "rootDir": "./src"
9
- },
10
- "include": ["src/**/*"]
11
- }
@@ -1 +0,0 @@
1
- {"root":["./src/index.ts"],"version":"5.9.2"}