@powerlines/plugin-oxlint 0.7.460 → 0.7.462

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.
@@ -1,4 +1,15 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@stryke/convert/neutral`);function t(t={}){return`{
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _stryke_convert_neutral = require("@stryke/convert/neutral");
3
+
4
+ //#region src/helpers/generate-config.ts
5
+ /**
6
+ * Generates an Oxlint configuration file content based on the provided options.
7
+ *
8
+ * @param options - The options for the Oxlint plugin.
9
+ * @returns The generated configuration as a string.
10
+ */
11
+ function generateConfig(options = {}) {
12
+ return `{
2
13
  "$schema": "./node_modules/oxlint/configuration_schema.json",
3
14
  "plugins": [
4
15
  "import",
@@ -14,9 +25,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
14
25
  "coverage/**",
15
26
  "node_modules/**",
16
27
  "temp/**",
17
- "tests/fixtures/**"${t.ignorePatterns?`,
18
- ${(0,e.toArray)(t.ignorePatterns).map(e=>`"${e}"`).join(`,
19
- `)}`:``}
28
+ "tests/fixtures/**"${options.ignorePatterns ? `,
29
+ ${(0, _stryke_convert_neutral.toArray)(options.ignorePatterns).map((pattern) => `"${pattern}"`).join(",\n ")}` : ""}
20
30
  ],
21
31
  "rules": {
22
32
  "import/named": "error",
@@ -42,4 +52,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
42
52
  ],
43
53
  "unicorn/prefer-node-protocol": "error"
44
54
  }
45
- }`}exports.generateConfig=t;
55
+ }`;
56
+ }
57
+
58
+ //#endregion
59
+ exports.generateConfig = generateConfig;
@@ -1,4 +1,14 @@
1
- import{toArray as e}from"@stryke/convert/neutral";function t(t={}){return`{
1
+ import { toArray } from "@stryke/convert/neutral";
2
+
3
+ //#region src/helpers/generate-config.ts
4
+ /**
5
+ * Generates an Oxlint configuration file content based on the provided options.
6
+ *
7
+ * @param options - The options for the Oxlint plugin.
8
+ * @returns The generated configuration as a string.
9
+ */
10
+ function generateConfig(options = {}) {
11
+ return `{
2
12
  "$schema": "./node_modules/oxlint/configuration_schema.json",
3
13
  "plugins": [
4
14
  "import",
@@ -14,9 +24,8 @@ import{toArray as e}from"@stryke/convert/neutral";function t(t={}){return`{
14
24
  "coverage/**",
15
25
  "node_modules/**",
16
26
  "temp/**",
17
- "tests/fixtures/**"${t.ignorePatterns?`,
18
- ${e(t.ignorePatterns).map(e=>`"${e}"`).join(`,
19
- `)}`:``}
27
+ "tests/fixtures/**"${options.ignorePatterns ? `,
28
+ ${toArray(options.ignorePatterns).map((pattern) => `"${pattern}"`).join(",\n ")}` : ""}
20
29
  ],
21
30
  "rules": {
22
31
  "import/named": "error",
@@ -42,5 +51,9 @@ import{toArray as e}from"@stryke/convert/neutral";function t(t={}){return`{
42
51
  ],
43
52
  "unicorn/prefer-node-protocol": "error"
44
53
  }
45
- }`}export{t as generateConfig};
54
+ }`;
55
+ }
56
+
57
+ //#endregion
58
+ export { generateConfig };
46
59
  //# sourceMappingURL=generate-config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-config.mjs","names":[],"sources":["../../src/helpers/generate-config.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/neutral\";\nimport { OxlintPluginOptions } from \"../types/plugin\";\n\n/**\n * Generates an Oxlint configuration file content based on the provided options.\n *\n * @param options - The options for the Oxlint plugin.\n * @returns The generated configuration as a string.\n */\nexport function generateConfig(options: OxlintPluginOptions = {}): string {\n return `{\n \"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n \"plugins\": [\n \"import\",\n \"jsdoc\",\n \"unicorn\",\n \"typescript\",\n \"oxc\"\n ],\n \"ignorePatterns\": [\n \"crates/**\",\n \"dist/**\",\n \"build/**\",\n \"coverage/**\",\n \"node_modules/**\",\n \"temp/**\",\n \"tests/fixtures/**\"${\n options.ignorePatterns\n ? `,\n ${toArray(options.ignorePatterns)\n .map(pattern => `\"${pattern}\"`)\n .join(\",\\n \")}`\n : \"\"\n }\n ],\n \"rules\": {\n \"import/named\": \"error\",\n \"import/namespace\": [\n \"error\",\n {\n \"allowComputed\": true\n }\n ],\n \"no-unused-expressions\": [\n \"warn\",\n {\n \"allowShortCircuit\": true,\n \"allowTaggedTemplates\": true\n }\n ],\n \"no-unused-vars\": [\n \"warn\",\n {\n \"varsIgnorePattern\": \"^_\",\n \"argsIgnorePattern\": \"^_\"\n }\n ],\n \"unicorn/prefer-node-protocol\": \"error\"\n }\n}`;\n}\n"],"mappings":"kDA2BA,SAAgB,EAAe,EAA+B,EAAE,CAAU,CACxE,MAAO;;;;;;;;;;;;;;;;yBAiBH,EAAQ,eACJ;MACJ,EAAQ,EAAQ,eAAe,CAC9B,IAAI,GAAW,IAAI,EAAQ,GAAG,CAC9B,KAAK;MAAU,GACZ,GACL"}
1
+ {"version":3,"file":"generate-config.mjs","names":[],"sources":["../../src/helpers/generate-config.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/neutral\";\nimport { OxlintPluginOptions } from \"../types/plugin\";\n\n/**\n * Generates an Oxlint configuration file content based on the provided options.\n *\n * @param options - The options for the Oxlint plugin.\n * @returns The generated configuration as a string.\n */\nexport function generateConfig(options: OxlintPluginOptions = {}): string {\n return `{\n \"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n \"plugins\": [\n \"import\",\n \"jsdoc\",\n \"unicorn\",\n \"typescript\",\n \"oxc\"\n ],\n \"ignorePatterns\": [\n \"crates/**\",\n \"dist/**\",\n \"build/**\",\n \"coverage/**\",\n \"node_modules/**\",\n \"temp/**\",\n \"tests/fixtures/**\"${\n options.ignorePatterns\n ? `,\n ${toArray(options.ignorePatterns)\n .map(pattern => `\"${pattern}\"`)\n .join(\",\\n \")}`\n : \"\"\n }\n ],\n \"rules\": {\n \"import/named\": \"error\",\n \"import/namespace\": [\n \"error\",\n {\n \"allowComputed\": true\n }\n ],\n \"no-unused-expressions\": [\n \"warn\",\n {\n \"allowShortCircuit\": true,\n \"allowTaggedTemplates\": true\n }\n ],\n \"no-unused-vars\": [\n \"warn\",\n {\n \"varsIgnorePattern\": \"^_\",\n \"argsIgnorePattern\": \"^_\"\n }\n ],\n \"unicorn/prefer-node-protocol\": \"error\"\n }\n}`;\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,eAAe,UAA+B,EAAE,EAAU;AACxE,QAAO;;;;;;;;;;;;;;;;yBAiBH,QAAQ,iBACJ;MACJ,QAAQ,QAAQ,eAAe,CAC9B,KAAI,YAAW,IAAI,QAAQ,GAAG,CAC9B,KAAK,UAAU,KACZ,GACL"}
@@ -1 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./generate-config.cjs`);exports.generateConfig=e.generateConfig;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_helpers_generate_config = require('./generate-config.cjs');
3
+
4
+ exports.generateConfig = require_helpers_generate_config.generateConfig;
@@ -1 +1,3 @@
1
- import{generateConfig as e}from"./generate-config.mjs";export{e as generateConfig};
1
+ import { generateConfig } from "./generate-config.mjs";
2
+
3
+ export { generateConfig };
package/dist/index.cjs CHANGED
@@ -1 +1,78 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require(`@stryke/cli/execute`),t=require(`@stryke/convert/to-array`),n=require(`@stryke/fs/exists`),r=require(`@stryke/fs/get-parent-path`),i=require(`@stryke/fs/package-fns`),a=require(`@stryke/path/join`);function o(o={}){return{name:`oxlint`,async config(){return this.debug("Providing default configuration for the Powerlines `oxlint` linting plugin."),{oxlint:{configFile:`.oxlintrc.json`,deny:[],allow:[],warn:[],typeAware:!0,fix:!0,format:`stylish`,...o}}},configResolved(){this.devDependencies.oxlint=`^1.24.0`,this.config.oxlint.typeAware&&(this.devDependencies[`oxlint-tsgolint`]=`^0.2.1`)},async lint(){this.debug(`Linting project files with Oxlint.`);let o=[];if(this.config.oxlint.params&&o.push(...this.config.oxlint.params.split(` `).filter(Boolean)),!o.includes(`--ignore-pattern`)&&this.config.oxlint.ignorePatterns&&o.push(`--ignore-pattern=${(0,t.toArray)(this.config.oxlint.ignorePatterns).join(`,`)}`),this.config.oxlint.deny.forEach(e=>o.push(`-D`,e)),this.config.oxlint.allow.forEach(e=>o.push(`-A`,e)),this.config.oxlint.warn.forEach(e=>o.push(`-W`,e)),!o.includes(`-c`)&&!o.includes(`--config`)){let e=(0,r.getParentPath)(this.config.oxlint.configFile,this.config.root,{ignoreCase:!0,skipCwd:!1,includeNameInResults:!0});e&&!(0,n.existsSync)(e)&&this.config.oxlint.configFile!==`.oxlintrc.json`&&(e=(0,r.getParentPath)(`.oxlintrc.json`,this.config.root,{ignoreCase:!0,skipCwd:!1,includeNameInResults:!0})),e&&(0,n.existsSync)(e)&&o.push(`-c`,e)}if(!o.includes(`--type-aware`)&&this.config.oxlint.typeAware&&o.push(`--type-aware`),o.includes(`--tsconfig`)||o.push(`--tsconfig`,this.tsconfig.tsconfigFilePath),!o.includes(`-f`)&&!o.includes(`--format`)&&o.push(`-f`,this.config.oxlint.format||`stylish`),this.config.oxlint.fix!==!1&&!o.includes(`--fix`)&&!o.includes(`--fix-suggestions`)&&!o.includes(`--fix-dangerously`)&&(this.config.oxlint.fix===!0?o.push(`--fix`):this.config.oxlint.fix===`suggestions`?o.push(`--fix-suggestions`):this.config.oxlint.fix===`dangerously`&&o.push(`--fix-dangerously`)),this.config.oxlint.oxlintPath){o.unshift(this.config.oxlint.oxlintPath,this.config.root);let t=await(0,e.execute)(o.join(` `),this.config.cwd);if(t.failed)throw Error(`Oxlint process exited with code ${t.exitCode}.`)}else{let t=await(0,i.isPackageListed)(`oxlint`,this.config.root);o.unshift(t?`./`:this.config.root);let n=await(0,e.executePackage)(`oxlint`,o,t?(0,a.joinPaths)(this.config.cwd,this.config.root):this.config.cwd);if(n.failed)throw Error(`Oxlint process exited with code ${n.exitCode}.`)}}}}exports.default=o,exports.plugin=o;
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ let _stryke_cli_execute = require("@stryke/cli/execute");
3
+ let _stryke_convert_to_array = require("@stryke/convert/to-array");
4
+ let _stryke_fs_exists = require("@stryke/fs/exists");
5
+ let _stryke_fs_get_parent_path = require("@stryke/fs/get-parent-path");
6
+ let _stryke_fs_package_fns = require("@stryke/fs/package-fns");
7
+ let _stryke_path_join = require("@stryke/path/join");
8
+
9
+ //#region src/index.ts
10
+ /**
11
+ * A Powerlines plugin to assist in linting a project with Oxlint.
12
+ */
13
+ function plugin(options = {}) {
14
+ return {
15
+ name: "oxlint",
16
+ async config() {
17
+ this.debug("Providing default configuration for the Powerlines `oxlint` linting plugin.");
18
+ return { oxlint: {
19
+ configFile: ".oxlintrc.json",
20
+ deny: [],
21
+ allow: [],
22
+ warn: [],
23
+ typeAware: true,
24
+ fix: true,
25
+ format: "stylish",
26
+ ...options
27
+ } };
28
+ },
29
+ configResolved() {
30
+ this.devDependencies.oxlint = "^1.24.0";
31
+ if (this.config.oxlint.typeAware) this.devDependencies["oxlint-tsgolint"] = "^0.2.1";
32
+ },
33
+ async lint() {
34
+ this.debug("Linting project files with Oxlint.");
35
+ const args = [];
36
+ if (this.config.oxlint.params) args.push(...this.config.oxlint.params.split(" ").filter(Boolean));
37
+ if (!args.includes("--ignore-pattern") && this.config.oxlint.ignorePatterns) args.push(`--ignore-pattern=${(0, _stryke_convert_to_array.toArray)(this.config.oxlint.ignorePatterns).join(",")}`);
38
+ this.config.oxlint.deny.forEach((d) => args.push("-D", d));
39
+ this.config.oxlint.allow.forEach((a) => args.push("-A", a));
40
+ this.config.oxlint.warn.forEach((w) => args.push("-W", w));
41
+ if (!args.includes("-c") && !args.includes("--config")) {
42
+ let configFile = (0, _stryke_fs_get_parent_path.getParentPath)(this.config.oxlint.configFile, this.config.root, {
43
+ ignoreCase: true,
44
+ skipCwd: false,
45
+ includeNameInResults: true
46
+ });
47
+ if (configFile && !(0, _stryke_fs_exists.existsSync)(configFile) && this.config.oxlint.configFile !== ".oxlintrc.json") configFile = (0, _stryke_fs_get_parent_path.getParentPath)(".oxlintrc.json", this.config.root, {
48
+ ignoreCase: true,
49
+ skipCwd: false,
50
+ includeNameInResults: true
51
+ });
52
+ if (configFile && (0, _stryke_fs_exists.existsSync)(configFile)) args.push("-c", configFile);
53
+ }
54
+ if (!args.includes("--type-aware") && this.config.oxlint.typeAware) args.push("--type-aware");
55
+ if (!args.includes("--tsconfig")) args.push("--tsconfig", this.tsconfig.tsconfigFilePath);
56
+ if (!args.includes("-f") && !args.includes("--format")) args.push("-f", this.config.oxlint.format || "stylish");
57
+ if (this.config.oxlint.fix !== false && !args.includes("--fix") && !args.includes("--fix-suggestions") && !args.includes("--fix-dangerously")) {
58
+ if (this.config.oxlint.fix === true) args.push("--fix");
59
+ else if (this.config.oxlint.fix === "suggestions") args.push("--fix-suggestions");
60
+ else if (this.config.oxlint.fix === "dangerously") args.push("--fix-dangerously");
61
+ }
62
+ if (!this.config.oxlint.oxlintPath) {
63
+ const isOxlintListed = await (0, _stryke_fs_package_fns.isPackageListed)("oxlint", this.config.root);
64
+ args.unshift(isOxlintListed ? "./" : this.config.root);
65
+ const result = await (0, _stryke_cli_execute.executePackage)("oxlint", args, isOxlintListed ? (0, _stryke_path_join.joinPaths)(this.config.cwd, this.config.root) : this.config.cwd);
66
+ if (result.failed) throw new Error(`Oxlint process exited with code ${result.exitCode}.`);
67
+ } else {
68
+ args.unshift(this.config.oxlint.oxlintPath, this.config.root);
69
+ const result = await (0, _stryke_cli_execute.execute)(args.join(" "), this.config.cwd);
70
+ if (result.failed) throw new Error(`Oxlint process exited with code ${result.exitCode}.`);
71
+ }
72
+ }
73
+ };
74
+ }
75
+
76
+ //#endregion
77
+ exports.default = plugin;
78
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1,2 +1,77 @@
1
- import{execute as e,executePackage as t}from"@stryke/cli/execute";import{toArray as n}from"@stryke/convert/to-array";import{existsSync as r}from"@stryke/fs/exists";import{getParentPath as i}from"@stryke/fs/get-parent-path";import{isPackageListed as a}from"@stryke/fs/package-fns";import{joinPaths as o}from"@stryke/path/join";function s(s={}){return{name:`oxlint`,async config(){return this.debug("Providing default configuration for the Powerlines `oxlint` linting plugin."),{oxlint:{configFile:`.oxlintrc.json`,deny:[],allow:[],warn:[],typeAware:!0,fix:!0,format:`stylish`,...s}}},configResolved(){this.devDependencies.oxlint=`^1.24.0`,this.config.oxlint.typeAware&&(this.devDependencies[`oxlint-tsgolint`]=`^0.2.1`)},async lint(){this.debug(`Linting project files with Oxlint.`);let s=[];if(this.config.oxlint.params&&s.push(...this.config.oxlint.params.split(` `).filter(Boolean)),!s.includes(`--ignore-pattern`)&&this.config.oxlint.ignorePatterns&&s.push(`--ignore-pattern=${n(this.config.oxlint.ignorePatterns).join(`,`)}`),this.config.oxlint.deny.forEach(e=>s.push(`-D`,e)),this.config.oxlint.allow.forEach(e=>s.push(`-A`,e)),this.config.oxlint.warn.forEach(e=>s.push(`-W`,e)),!s.includes(`-c`)&&!s.includes(`--config`)){let e=i(this.config.oxlint.configFile,this.config.root,{ignoreCase:!0,skipCwd:!1,includeNameInResults:!0});e&&!r(e)&&this.config.oxlint.configFile!==`.oxlintrc.json`&&(e=i(`.oxlintrc.json`,this.config.root,{ignoreCase:!0,skipCwd:!1,includeNameInResults:!0})),e&&r(e)&&s.push(`-c`,e)}if(!s.includes(`--type-aware`)&&this.config.oxlint.typeAware&&s.push(`--type-aware`),s.includes(`--tsconfig`)||s.push(`--tsconfig`,this.tsconfig.tsconfigFilePath),!s.includes(`-f`)&&!s.includes(`--format`)&&s.push(`-f`,this.config.oxlint.format||`stylish`),this.config.oxlint.fix!==!1&&!s.includes(`--fix`)&&!s.includes(`--fix-suggestions`)&&!s.includes(`--fix-dangerously`)&&(this.config.oxlint.fix===!0?s.push(`--fix`):this.config.oxlint.fix===`suggestions`?s.push(`--fix-suggestions`):this.config.oxlint.fix===`dangerously`&&s.push(`--fix-dangerously`)),this.config.oxlint.oxlintPath){s.unshift(this.config.oxlint.oxlintPath,this.config.root);let t=await e(s.join(` `),this.config.cwd);if(t.failed)throw Error(`Oxlint process exited with code ${t.exitCode}.`)}else{let e=await a(`oxlint`,this.config.root);s.unshift(e?`./`:this.config.root);let n=await t(`oxlint`,s,e?o(this.config.cwd,this.config.root):this.config.cwd);if(n.failed)throw Error(`Oxlint process exited with code ${n.exitCode}.`)}}}}export{s as default,s as plugin};
1
+ import { execute, executePackage } from "@stryke/cli/execute";
2
+ import { toArray } from "@stryke/convert/to-array";
3
+ import { existsSync } from "@stryke/fs/exists";
4
+ import { getParentPath } from "@stryke/fs/get-parent-path";
5
+ import { isPackageListed } from "@stryke/fs/package-fns";
6
+ import { joinPaths } from "@stryke/path/join";
7
+
8
+ //#region src/index.ts
9
+ /**
10
+ * A Powerlines plugin to assist in linting a project with Oxlint.
11
+ */
12
+ function plugin(options = {}) {
13
+ return {
14
+ name: "oxlint",
15
+ async config() {
16
+ this.debug("Providing default configuration for the Powerlines `oxlint` linting plugin.");
17
+ return { oxlint: {
18
+ configFile: ".oxlintrc.json",
19
+ deny: [],
20
+ allow: [],
21
+ warn: [],
22
+ typeAware: true,
23
+ fix: true,
24
+ format: "stylish",
25
+ ...options
26
+ } };
27
+ },
28
+ configResolved() {
29
+ this.devDependencies.oxlint = "^1.24.0";
30
+ if (this.config.oxlint.typeAware) this.devDependencies["oxlint-tsgolint"] = "^0.2.1";
31
+ },
32
+ async lint() {
33
+ this.debug("Linting project files with Oxlint.");
34
+ const args = [];
35
+ if (this.config.oxlint.params) args.push(...this.config.oxlint.params.split(" ").filter(Boolean));
36
+ if (!args.includes("--ignore-pattern") && this.config.oxlint.ignorePatterns) args.push(`--ignore-pattern=${toArray(this.config.oxlint.ignorePatterns).join(",")}`);
37
+ this.config.oxlint.deny.forEach((d) => args.push("-D", d));
38
+ this.config.oxlint.allow.forEach((a) => args.push("-A", a));
39
+ this.config.oxlint.warn.forEach((w) => args.push("-W", w));
40
+ if (!args.includes("-c") && !args.includes("--config")) {
41
+ let configFile = getParentPath(this.config.oxlint.configFile, this.config.root, {
42
+ ignoreCase: true,
43
+ skipCwd: false,
44
+ includeNameInResults: true
45
+ });
46
+ if (configFile && !existsSync(configFile) && this.config.oxlint.configFile !== ".oxlintrc.json") configFile = getParentPath(".oxlintrc.json", this.config.root, {
47
+ ignoreCase: true,
48
+ skipCwd: false,
49
+ includeNameInResults: true
50
+ });
51
+ if (configFile && existsSync(configFile)) args.push("-c", configFile);
52
+ }
53
+ if (!args.includes("--type-aware") && this.config.oxlint.typeAware) args.push("--type-aware");
54
+ if (!args.includes("--tsconfig")) args.push("--tsconfig", this.tsconfig.tsconfigFilePath);
55
+ if (!args.includes("-f") && !args.includes("--format")) args.push("-f", this.config.oxlint.format || "stylish");
56
+ if (this.config.oxlint.fix !== false && !args.includes("--fix") && !args.includes("--fix-suggestions") && !args.includes("--fix-dangerously")) {
57
+ if (this.config.oxlint.fix === true) args.push("--fix");
58
+ else if (this.config.oxlint.fix === "suggestions") args.push("--fix-suggestions");
59
+ else if (this.config.oxlint.fix === "dangerously") args.push("--fix-dangerously");
60
+ }
61
+ if (!this.config.oxlint.oxlintPath) {
62
+ const isOxlintListed = await isPackageListed("oxlint", this.config.root);
63
+ args.unshift(isOxlintListed ? "./" : this.config.root);
64
+ const result = await executePackage("oxlint", args, isOxlintListed ? joinPaths(this.config.cwd, this.config.root) : this.config.cwd);
65
+ if (result.failed) throw new Error(`Oxlint process exited with code ${result.exitCode}.`);
66
+ } else {
67
+ args.unshift(this.config.oxlint.oxlintPath, this.config.root);
68
+ const result = await execute(args.join(" "), this.config.cwd);
69
+ if (result.failed) throw new Error(`Oxlint process exited with code ${result.exitCode}.`);
70
+ }
71
+ }
72
+ };
73
+ }
74
+
75
+ //#endregion
76
+ export { plugin as default, plugin };
2
77
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { execute, executePackage } from \"@stryke/cli/execute\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getParentPath } from \"@stryke/fs/get-parent-path\";\nimport { isPackageListed } from \"@stryke/fs/package-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { Plugin } from \"powerlines\";\nimport { OxlintPluginContext, OxlintPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n oxlint?: OxlintPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in linting a project with Oxlint.\n */\nexport function plugin(\n options: OxlintPluginOptions = {}\n): Plugin<OxlintPluginContext> {\n return {\n name: \"oxlint\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `oxlint` linting plugin.\"\n );\n\n return {\n oxlint: {\n configFile: \".oxlintrc.json\",\n deny: [],\n allow: [],\n warn: [],\n typeAware: true,\n fix: true,\n format: \"stylish\",\n ...options\n }\n };\n },\n configResolved() {\n this.devDependencies.oxlint = \"^1.24.0\";\n if (this.config.oxlint.typeAware) {\n this.devDependencies[\"oxlint-tsgolint\"] = \"^0.2.1\";\n }\n },\n async lint() {\n this.debug(\"Linting project files with Oxlint.\");\n\n const args: string[] = [];\n\n if (this.config.oxlint.params) {\n args.push(...this.config.oxlint.params.split(\" \").filter(Boolean));\n }\n\n if (\n !args.includes(\"--ignore-pattern\") &&\n this.config.oxlint.ignorePatterns\n ) {\n args.push(\n `--ignore-pattern=${toArray(this.config.oxlint.ignorePatterns).join(\",\")}`\n );\n }\n\n this.config.oxlint.deny.forEach(d => args.push(\"-D\", d));\n this.config.oxlint.allow.forEach(a => args.push(\"-A\", a));\n this.config.oxlint.warn.forEach(w => args.push(\"-W\", w));\n\n if (!args.includes(\"-c\") && !args.includes(\"--config\")) {\n let configFile = getParentPath(\n this.config.oxlint.configFile,\n this.config.root,\n {\n ignoreCase: true,\n skipCwd: false,\n includeNameInResults: true\n }\n );\n if (\n configFile &&\n !existsSync(configFile) &&\n this.config.oxlint.configFile !== \".oxlintrc.json\"\n ) {\n configFile = getParentPath(\".oxlintrc.json\", this.config.root, {\n ignoreCase: true,\n skipCwd: false,\n includeNameInResults: true\n });\n }\n\n if (configFile && existsSync(configFile)) {\n args.push(\"-c\", configFile);\n }\n }\n\n if (!args.includes(\"--type-aware\") && this.config.oxlint.typeAware) {\n args.push(\"--type-aware\");\n }\n\n if (!args.includes(\"--tsconfig\")) {\n args.push(\"--tsconfig\", this.tsconfig.tsconfigFilePath);\n }\n\n if (!args.includes(\"-f\") && !args.includes(\"--format\")) {\n args.push(\"-f\", this.config.oxlint.format || \"stylish\");\n }\n\n if (\n this.config.oxlint.fix !== false &&\n !args.includes(\"--fix\") &&\n !args.includes(\"--fix-suggestions\") &&\n !args.includes(\"--fix-dangerously\")\n ) {\n if (this.config.oxlint.fix === true) {\n args.push(\"--fix\");\n } else if (this.config.oxlint.fix === \"suggestions\") {\n args.push(\"--fix-suggestions\");\n } else if (this.config.oxlint.fix === \"dangerously\") {\n args.push(\"--fix-dangerously\");\n }\n }\n\n if (!this.config.oxlint.oxlintPath) {\n const isOxlintListed = await isPackageListed(\n \"oxlint\",\n this.config.root\n );\n\n args.unshift(isOxlintListed ? \"./\" : this.config.root);\n\n const result = await executePackage(\n \"oxlint\",\n args,\n isOxlintListed\n ? joinPaths(this.config.cwd, this.config.root)\n : this.config.cwd\n );\n if (result.failed) {\n throw new Error(\n `Oxlint process exited with code ${result.exitCode}.`\n );\n }\n } else {\n args.unshift(this.config.oxlint.oxlintPath, this.config.root);\n\n const result = await execute(args.join(\" \"), this.config.cwd);\n if (result.failed) {\n throw new Error(\n `Oxlint process exited with code ${result.exitCode}.`\n );\n }\n }\n }\n };\n}\n\nexport default plugin;\n"],"mappings":"sUAsCA,SAAgB,EACd,EAA+B,EAAE,CACJ,CAC7B,MAAO,CACL,KAAM,SACN,MAAM,QAAS,CAKb,OAJA,KAAK,MACH,8EACD,CAEM,CACL,OAAQ,CACN,WAAY,iBACZ,KAAM,EAAE,CACR,MAAO,EAAE,CACT,KAAM,EAAE,CACR,UAAW,GACX,IAAK,GACL,OAAQ,UACR,GAAG,EACJ,CACF,EAEH,gBAAiB,CACf,KAAK,gBAAgB,OAAS,UAC1B,KAAK,OAAO,OAAO,YACrB,KAAK,gBAAgB,mBAAqB,WAG9C,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MAAQ,IAC3B,CAAC,EAAK,SAAS,QAAQ,EACvB,CAAC,EAAK,SAAS,oBAAoB,EACnC,CAAC,EAAK,SAAS,oBAAoB,GAE/B,KAAK,OAAO,OAAO,MAAQ,GAC7B,EAAK,KAAK,QAAQ,CACT,KAAK,OAAO,OAAO,MAAQ,cACpC,EAAK,KAAK,oBAAoB,CACrB,KAAK,OAAO,OAAO,MAAQ,eACpC,EAAK,KAAK,oBAAoB,EAI7B,KAAK,OAAO,OAAO,WAoBjB,CACL,EAAK,QAAQ,KAAK,OAAO,OAAO,WAAY,KAAK,OAAO,KAAK,CAE7D,IAAM,EAAS,MAAM,EAAQ,EAAK,KAAK,IAAI,CAAE,KAAK,OAAO,IAAI,CAC7D,GAAI,EAAO,OACT,MAAU,MACR,mCAAmC,EAAO,SAAS,GACpD,KA3B+B,CAClC,IAAM,EAAiB,MAAM,EAC3B,SACA,KAAK,OAAO,KACb,CAED,EAAK,QAAQ,EAAiB,KAAO,KAAK,OAAO,KAAK,CAEtD,IAAM,EAAS,MAAM,EACnB,SACA,EACA,EACI,EAAU,KAAK,OAAO,IAAK,KAAK,OAAO,KAAK,CAC5C,KAAK,OAAO,IACjB,CACD,GAAI,EAAO,OACT,MAAU,MACR,mCAAmC,EAAO,SAAS,GACpD,GAaR"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { execute, executePackage } from \"@stryke/cli/execute\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getParentPath } from \"@stryke/fs/get-parent-path\";\nimport { isPackageListed } from \"@stryke/fs/package-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { Plugin } from \"powerlines\";\nimport { OxlintPluginContext, OxlintPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n oxlint?: OxlintPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in linting a project with Oxlint.\n */\nexport function plugin(\n options: OxlintPluginOptions = {}\n): Plugin<OxlintPluginContext> {\n return {\n name: \"oxlint\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `oxlint` linting plugin.\"\n );\n\n return {\n oxlint: {\n configFile: \".oxlintrc.json\",\n deny: [],\n allow: [],\n warn: [],\n typeAware: true,\n fix: true,\n format: \"stylish\",\n ...options\n }\n };\n },\n configResolved() {\n this.devDependencies.oxlint = \"^1.24.0\";\n if (this.config.oxlint.typeAware) {\n this.devDependencies[\"oxlint-tsgolint\"] = \"^0.2.1\";\n }\n },\n async lint() {\n this.debug(\"Linting project files with Oxlint.\");\n\n const args: string[] = [];\n\n if (this.config.oxlint.params) {\n args.push(...this.config.oxlint.params.split(\" \").filter(Boolean));\n }\n\n if (\n !args.includes(\"--ignore-pattern\") &&\n this.config.oxlint.ignorePatterns\n ) {\n args.push(\n `--ignore-pattern=${toArray(this.config.oxlint.ignorePatterns).join(\",\")}`\n );\n }\n\n this.config.oxlint.deny.forEach(d => args.push(\"-D\", d));\n this.config.oxlint.allow.forEach(a => args.push(\"-A\", a));\n this.config.oxlint.warn.forEach(w => args.push(\"-W\", w));\n\n if (!args.includes(\"-c\") && !args.includes(\"--config\")) {\n let configFile = getParentPath(\n this.config.oxlint.configFile,\n this.config.root,\n {\n ignoreCase: true,\n skipCwd: false,\n includeNameInResults: true\n }\n );\n if (\n configFile &&\n !existsSync(configFile) &&\n this.config.oxlint.configFile !== \".oxlintrc.json\"\n ) {\n configFile = getParentPath(\".oxlintrc.json\", this.config.root, {\n ignoreCase: true,\n skipCwd: false,\n includeNameInResults: true\n });\n }\n\n if (configFile && existsSync(configFile)) {\n args.push(\"-c\", configFile);\n }\n }\n\n if (!args.includes(\"--type-aware\") && this.config.oxlint.typeAware) {\n args.push(\"--type-aware\");\n }\n\n if (!args.includes(\"--tsconfig\")) {\n args.push(\"--tsconfig\", this.tsconfig.tsconfigFilePath);\n }\n\n if (!args.includes(\"-f\") && !args.includes(\"--format\")) {\n args.push(\"-f\", this.config.oxlint.format || \"stylish\");\n }\n\n if (\n this.config.oxlint.fix !== false &&\n !args.includes(\"--fix\") &&\n !args.includes(\"--fix-suggestions\") &&\n !args.includes(\"--fix-dangerously\")\n ) {\n if (this.config.oxlint.fix === true) {\n args.push(\"--fix\");\n } else if (this.config.oxlint.fix === \"suggestions\") {\n args.push(\"--fix-suggestions\");\n } else if (this.config.oxlint.fix === \"dangerously\") {\n args.push(\"--fix-dangerously\");\n }\n }\n\n if (!this.config.oxlint.oxlintPath) {\n const isOxlintListed = await isPackageListed(\n \"oxlint\",\n this.config.root\n );\n\n args.unshift(isOxlintListed ? \"./\" : this.config.root);\n\n const result = await executePackage(\n \"oxlint\",\n args,\n isOxlintListed\n ? joinPaths(this.config.cwd, this.config.root)\n : this.config.cwd\n );\n if (result.failed) {\n throw new Error(\n `Oxlint process exited with code ${result.exitCode}.`\n );\n }\n } else {\n args.unshift(this.config.oxlint.oxlintPath, this.config.root);\n\n const result = await execute(args.join(\" \"), this.config.cwd);\n if (result.failed) {\n throw new Error(\n `Oxlint process exited with code ${result.exitCode}.`\n );\n }\n }\n }\n };\n}\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAsCA,SAAgB,OACd,UAA+B,EAAE,EACJ;AAC7B,QAAO;EACL,MAAM;EACN,MAAM,SAAS;AACb,QAAK,MACH,8EACD;AAED,UAAO,EACL,QAAQ;IACN,YAAY;IACZ,MAAM,EAAE;IACR,OAAO,EAA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,CAAC,KAAK,SAAS,aAAa,CAC9B,MAAK,KAAK,cAAc,KAAK,SAAS,iBAAiB;AAGzD,OAAI,CAAC,KAAK,SAAS,KAAK,IAAI,CAAC,KAAK,SAAS,WAAW,CACpD,MAAK,KAAK,MAAM,KAAK,OAAO,OAAO,UAAU,UAAU;AAGzD,OACE,KAAK,OAAO,OAAO,QAAQ,SAC3B,CAAC,KAAK,SAAS,QAAQ,IACvB,CAAC,KAAK,SAAS,oBAAoB,IACnC,CAAC,KAAK,SAAS,oBAAoB,EAEnC;QAAI,KAAK,OAAO,OAAO,QAAQ,KAC7B,MAAK,KAAK,QAAQ;aACT,KAAK,OAAO,OAAO,QAAQ,cACpC,MAAK,KAAK,oBAAoB;aACrB,KAAK,OAAO,OAAO,QAAQ,cACpC,MAAK,KAAK,oBAAoB;;AAIlC,OAAI,CAAC,KAAK,OAAO,OAAO,YAAY;IAClC,MAAM,iBAAiB,MAAM,gBAC3B,UACA,KAAK,OAAO,KACb;AAED,SAAK,QAAQ,iBAAiB,OAAO,KAAK,OAAO,KAAK;IAEtD,MAAM,SAAS,MAAM,eACnB,UACA,MACA,iBACI,UAAU,KAAK,OAAO,KAAK,KAAK,OAAO,KAAK,GAC5C,KAAK,OAAO,IACjB;AACD,QAAI,OAAO,OACT,OAAM,IAAI,MACR,mCAAmC,OAAO,SAAS,GACpD;UAEE;AACL,SAAK,QAAQ,KAAK,OAAO,OAAO,YAAY,KAAK,OAAO,KAAK;IAE7D,MAAM,SAAS,MAAM,QAAQ,KAAK,KAAK,IAAI,EAAE,KAAK,OAAO,IAAI;AAC7D,QAAI,OAAO,OACT,OAAM,IAAI,MACR,mCAAmC,OAAO,SAAS,GACpD;;;EAIR"}
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-oxlint",
3
- "version": "0.7.460",
3
+ "version": "0.7.462",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for running Oxlint on the codebase.",
6
6
  "repository": {
@@ -122,15 +122,15 @@
122
122
  "defu": "^6.1.7",
123
123
  "oxlint": "^1.62.0",
124
124
  "oxlint-tsgolint": "^0.14.2",
125
- "powerlines": "^0.46.3"
125
+ "powerlines": "^0.46.5"
126
126
  },
127
127
  "devDependencies": {
128
- "@powerlines/plugin-plugin": "^0.12.407",
128
+ "@powerlines/plugin-plugin": "^0.12.409",
129
129
  "@types/node": "^25.6.0"
130
130
  },
131
131
  "publishConfig": { "access": "public" },
132
132
  "main": "./dist/index.cjs",
133
133
  "module": "./dist/index.mjs",
134
134
  "types": "./dist/index.d.cts",
135
- "gitHead": "9a51041e0817e438c49db05bb757b3bdbaf497ef"
135
+ "gitHead": "9af888c54e58a82744cc334a6b80da52429fa0ac"
136
136
  }