@genesislcap/eslint-stylelint-builder 14.436.0-FUI-2489.2 → 14.437.0

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/README.md CHANGED
@@ -1,19 +1,7 @@
1
- # ESLint, Oxlint, Oxfmt & Stylelint builder
1
+ # ESLint & Stylelint builder
2
2
 
3
- Builder used by **`genx lint`**. It runs **Oxlint**, **Oxfmt**, and **Stylelint** by default, and **ESLint** when requested.
3
+ Builder wrapping [ESLint](https://eslint.org/) and [Stylelint](https://stylelint.io/).
4
4
 
5
- ## Default pipeline (`genx lint` / `npm run lint`)
6
-
7
- 1. **Oxlint** — `oxlint .` (with `--fix` when fixing).
8
- 2. **Oxfmt** — format check or write (`oxfmt --check .` or `oxfmt .` with `--fix`).
9
- 3. **Stylelint** — `*.styles.ts` under the current working directory.
10
-
11
- ## Opt-in linters
12
-
13
- - **ESLint only:** `genx lint -l eslint` (use `--profile` for `TIMING=1` rule timings).
14
- - **Other flags:** `-l oxfmt`, `-l oxlint`, `-l stylelint`, or combine as supported by the CLI.
15
-
16
- Configs: [`@genesislcap/oxfmt-config`](../oxfmt-config/), [`@genesislcap/oxlint-config`](../oxlint-config/), root **`eslint.config.mjs`** (flat config) for ESLint, and **`@genesislcap/stylelint-config`** for Stylelint.
17
5
 
18
6
  ## Installation
19
7
 
@@ -40,4 +28,4 @@ To enable this module in your application, follow the steps below.
40
28
  Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
41
29
 
42
30
  ### Licensed components
43
- Genesis low-code platform
31
+ Genesis low-code platform
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;yBAsFrC,KAAK,YAAY;AAAvC,wBAgDE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;yBAIrC,KAAK,YAAY;AAAvC,wBAuCE"}
package/dist/index.js CHANGED
@@ -1,121 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const os_1 = tslib_1.__importDefault(require("os"));
5
4
  const build_kit_1 = require("@genesislcap/build-kit");
6
5
  const consola_1 = tslib_1.__importDefault(require("consola"));
7
- /** ESLint file glob; Oxlint scope is aligned via `OXLINT_CLI_IGNORE_PATTERNS` (extensions + `.genx`). */
8
- const ESLINT_TS_JS_GLOB = '"./**/*.{ts,js,tsx,jsx}"';
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
- * TODO: https://github.com/apify/apify-oxlint-config/issues/7 - Migrate everything to oxlint after resolving this issue.
28
- */
29
- function runOxlintStep(cwd, oxlintFixArg) {
30
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
31
- consola_1.default.info('Running Oxlint...');
32
- const oxlint = yield (0, build_kit_1.resolveBin)('oxlint');
33
- const oxlintCmd = `${oxlint} .${OXLINT_CLI_IGNORE_PATTERNS}${oxlintFixArg}`;
34
- consola_1.default.info(`Executing: ${oxlintCmd}`);
35
- (0, build_kit_1.run)(cwd, oxlintCmd);
36
- consola_1.default.success('Oxlint completed');
37
- });
38
- }
39
- function runEslintStep(cwd_1, fixArg_1, profile_1, concurrency_1) {
40
- return tslib_1.__awaiter(this, arguments, void 0, function* (cwd, fixArg, profile, concurrency, disablePrettierNoise = false) {
41
- consola_1.default.info('Running ESLint...');
42
- if (profile) {
43
- process.env.TIMING = '1';
44
- }
45
- const eslint = yield (0, build_kit_1.resolveBin)('eslint');
46
- let concurrencyArg = '';
47
- if (concurrency) {
48
- concurrencyArg = ` --concurrency ${concurrency}`;
49
- }
50
- else if (!process.env.CI) {
51
- const defaultConcurrency = Math.max(1, Math.floor(os_1.default.cpus().length / 2));
52
- concurrencyArg = ` --concurrency ${defaultConcurrency}`;
53
- }
54
- const formattingNoiseArg = disablePrettierNoise
55
- ? [
56
- ' --rule "prettier/prettier: off"',
57
- ' --rule "max-len: off"',
58
- ' --rule "eol-last: off"',
59
- ' --rule "jsx-quotes: off"',
60
- ' --rule "spaced-comment: off"',
61
- ].join('')
62
- : '';
63
- const command = `${eslint} ${ESLINT_TS_JS_GLOB} ${fixArg}${concurrencyArg}${formattingNoiseArg}`;
64
- consola_1.default.info(`Executing: ${command}`);
65
- (0, build_kit_1.run)(cwd, command);
66
- consola_1.default.success('ESLint completed');
67
- });
68
- }
69
- function runOxfmtStep(cwd, fix) {
70
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
- consola_1.default.info('Running Oxfmt...');
72
- const oxfmt = yield (0, build_kit_1.resolveBin)('oxfmt');
73
- const oxfmtCmd = fix ? `${oxfmt} .` : `${oxfmt} --check .`;
74
- consola_1.default.info(`Executing: ${oxfmtCmd}`);
75
- (0, build_kit_1.run)(cwd, oxfmtCmd);
76
- consola_1.default.success('Oxfmt completed');
77
- });
78
- }
79
- function runStylelintStep(cwd, fixArg) {
80
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
81
- consola_1.default.info('Running Stylelint...');
82
- const stylelint = yield (0, build_kit_1.resolveBin)('stylelint');
83
- (0, build_kit_1.run)(cwd, `${stylelint} "./**/*.styles.ts" ${fixArg} --allow-empty-input`);
84
- consola_1.default.success('Stylelint completed');
85
- });
86
- }
6
+ const os_1 = tslib_1.__importDefault(require("os"));
87
7
  exports.default = (ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
88
8
  const { dirs: { cwd }, cli: { isLint, options: { profile, linter, fix, concurrency }, }, } = ctx;
89
9
  if (isLint) {
90
10
  const fixArg = fix ? ' --fix' : '';
91
- const oxlintFixArg = fix ? ' --fix' : '';
92
- // CI pipeline: Oxlint → ESLint → Oxfmt → Stylelint (code linters before format/style).
93
- if (linter === 'ci') {
94
- yield runOxlintStep(cwd, oxlintFixArg);
95
- // CI keeps ESLint for non-formatting correctness checks (e.g. import/no-extraneous-dependencies).
96
- yield runEslintStep(cwd, fixArg, profile, concurrency, true);
97
- yield runOxfmtStep(cwd, fix);
98
- yield runStylelintStep(cwd, fixArg);
99
- return;
100
- }
101
- // Default and `-l all`: Oxlint → Oxfmt → Stylelint. ESLint is opt-in (`-l eslint`) only.
102
- const runAll = !linter || linter === 'all';
103
- const runOxfmt = runAll || linter === 'oxfmt';
104
- const runOxlint = runAll || linter === 'oxlint';
105
- const runEslint = linter === 'eslint';
106
- const runStylelint = runAll || linter === 'stylelint';
107
- if (runOxlint) {
108
- yield runOxlintStep(cwd, oxlintFixArg);
109
- }
110
- if (runOxfmt) {
111
- yield runOxfmtStep(cwd, fix);
112
- }
113
- if (runEslint) {
114
- // ESLint-only mode: Prettier runs via ESLint (old-school standalone flow).
115
- yield runEslintStep(cwd, fixArg, profile, concurrency, false);
116
- }
117
- if (runStylelint) {
118
- yield runStylelintStep(cwd, fixArg);
11
+ if (!linter || linter === 'eslint' || linter === 'all') {
12
+ consola_1.default.info('Running ESLint...');
13
+ if (profile) {
14
+ process.env.TIMING = '1';
15
+ }
16
+ const eslint = yield (0, build_kit_1.resolveBin)('eslint');
17
+ let concurrencyArg = '';
18
+ if (concurrency) {
19
+ concurrencyArg = ` --concurrency ${concurrency}`;
20
+ }
21
+ else if (!process.env.CI) {
22
+ const defaultConcurrency = Math.max(1, Math.floor(os_1.default.cpus().length / 2));
23
+ concurrencyArg = ` --concurrency ${defaultConcurrency}`;
24
+ }
25
+ const command = `${eslint} "./**/*.{ts,tsx,js,jsx}" ${fixArg}${concurrencyArg}`;
26
+ consola_1.default.info(`Executing: ${command}`);
27
+ (0, build_kit_1.run)(cwd, command);
28
+ consola_1.default.success('ESLint completed');
29
+ }
30
+ if (!linter || linter === 'stylelint' || linter === 'all') {
31
+ consola_1.default.info('Running Stylelint...');
32
+ const stylelint = yield (0, build_kit_1.resolveBin)('stylelint');
33
+ (0, build_kit_1.run)(cwd, `${stylelint} "./**/*.styles.ts" ${fixArg} --allow-empty-input`);
34
+ consola_1.default.success('Stylelint completed');
119
35
  }
120
36
  }
121
37
  else {
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": "14.436.0-FUI-2489.2",
4
+ "version": "14.437.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -16,11 +16,9 @@
16
16
  "lint:fix": "genx lint --fix"
17
17
  },
18
18
  "dependencies": {
19
- "@genesislcap/build-kit": "14.436.0-FUI-2489.2",
19
+ "@genesislcap/build-kit": "14.437.0",
20
20
  "consola": "^3.0.2",
21
21
  "eslint": "^9.34.0",
22
- "oxfmt": "^0.44.0",
23
- "oxlint": "^1.59.0",
24
22
  "stylelint": "^14.0.0"
25
23
  },
26
24
  "repository": {
@@ -31,5 +29,5 @@
31
29
  "publishConfig": {
32
30
  "access": "public"
33
31
  },
34
- "gitHead": "16309f873a08dfa541589cd172482677ff5dfd20"
32
+ "gitHead": "c30c777f0ab5e45f4e931a9cc1200ac85bcace35"
35
33
  }
package/src/index.ts CHANGED
@@ -1,90 +1,7 @@
1
- import os from 'os';
2
1
  import { run, resolveBin } from '@genesislcap/build-kit';
3
2
  import type { BuildContext } from '@genesislcap/build-kit';
4
3
  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/apify/apify-oxlint-config/issues/7 - Migrate everything to oxlint after resolving this issue.
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
- }
4
+ import os from 'os';
88
5
 
89
6
  export default async (ctx: BuildContext) => {
90
7
  const {
@@ -96,40 +13,31 @@ export default async (ctx: BuildContext) => {
96
13
  } = ctx;
97
14
  if (isLint) {
98
15
  const fixArg = fix ? ' --fix' : '';
99
- const oxlintFixArg = fix ? ' --fix' : '';
100
-
101
- // CI pipeline: Oxlint → ESLint → Oxfmt → Stylelint (code linters before format/style).
102
- if (linter === 'ci') {
103
- await runOxlintStep(cwd, oxlintFixArg);
104
- // CI keeps ESLint for non-formatting correctness checks (e.g. import/no-extraneous-dependencies).
105
- await runEslintStep(cwd, fixArg, profile, concurrency, true);
106
- await runOxfmtStep(cwd, fix);
107
- await runStylelintStep(cwd, fixArg);
108
- return;
109
- }
110
-
111
- // Default and `-l all`: Oxlint → Oxfmt → Stylelint. ESLint is opt-in (`-l eslint`) only.
112
- const runAll = !linter || linter === 'all';
113
- const runOxfmt = runAll || linter === 'oxfmt';
114
- const runOxlint = runAll || linter === 'oxlint';
115
- const runEslint = linter === 'eslint';
116
- const runStylelint = runAll || linter === 'stylelint';
117
-
118
- if (runOxlint) {
119
- await runOxlintStep(cwd, oxlintFixArg);
120
- }
121
-
122
- if (runOxfmt) {
123
- await runOxfmtStep(cwd, fix);
124
- }
125
16
 
126
- if (runEslint) {
127
- // ESLint-only mode: Prettier runs via ESLint (old-school standalone flow).
128
- await runEslintStep(cwd, fixArg, profile, concurrency, false);
17
+ if (!linter || linter === 'eslint' || linter === 'all') {
18
+ consola.info('Running ESLint...');
19
+ if (profile) {
20
+ process.env.TIMING = '1';
21
+ }
22
+ const eslint = await resolveBin('eslint');
23
+ let concurrencyArg = '';
24
+ if (concurrency) {
25
+ concurrencyArg = ` --concurrency ${concurrency}`;
26
+ } else if (!process.env.CI) {
27
+ const defaultConcurrency = Math.max(1, Math.floor(os.cpus().length / 2));
28
+ concurrencyArg = ` --concurrency ${defaultConcurrency}`;
29
+ }
30
+ const command = `${eslint} "./**/*.{ts,tsx,js,jsx}" ${fixArg}${concurrencyArg}`;
31
+ consola.info(`Executing: ${command}`);
32
+ run(cwd, command);
33
+ consola.success('ESLint completed');
129
34
  }
130
35
 
131
- if (runStylelint) {
132
- await runStylelintStep(cwd, fixArg);
36
+ if (!linter || linter === 'stylelint' || linter === 'all') {
37
+ consola.info('Running Stylelint...');
38
+ const stylelint = await resolveBin('stylelint');
39
+ run(cwd, `${stylelint} "./**/*.styles.ts" ${fixArg} --allow-empty-input`);
40
+ consola.success('Stylelint completed');
133
41
  }
134
42
  } else {
135
43
  throw new Error(`Unrecognized command: ${JSON.stringify(ctx.cli.options)}`);
package/tsconfig.json CHANGED
@@ -2,10 +2,17 @@
2
2
  "extends": "../../../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "declarationDir": "./dist",
5
- "lib": ["ES2015", "ES2016", "ES2017", "ES2019"],
5
+ "lib": [
6
+ "ES2015",
7
+ "ES2016",
8
+ "ES2017",
9
+ "ES2019",
10
+ ],
6
11
  "module": "commonjs",
7
12
  "outDir": "./dist",
8
- "rootDir": "./src"
13
+ "rootDir": "./src",
9
14
  },
10
- "include": ["src/**/*"]
15
+ "include": [
16
+ "src/**/*"
17
+ ]
11
18
  }