@powerlines/plugin-eslint 0.8.121 → 0.8.122
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/dist/helpers/format-message.cjs +28 -2
- package/dist/helpers/format-message.mjs +27 -2
- package/dist/helpers/index.cjs +4 -1
- package/dist/helpers/index.mjs +3 -1
- package/dist/index.cjs +108 -2
- package/dist/index.mjs +104 -2
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +6 -6
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
let
|
|
2
|
-
|
|
1
|
+
let __stryke_path_find = require("@stryke/path/find");
|
|
2
|
+
let __stryke_path_normalize = require("@stryke/path/normalize");
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/format-message.ts
|
|
5
|
+
let MessageSeverity = /* @__PURE__ */ function(MessageSeverity$1) {
|
|
6
|
+
MessageSeverity$1[MessageSeverity$1["Warning"] = 1] = "Warning";
|
|
7
|
+
MessageSeverity$1[MessageSeverity$1["Error"] = 2] = "Error";
|
|
8
|
+
return MessageSeverity$1;
|
|
9
|
+
}({});
|
|
10
|
+
function formatMessage(dir, messages, filePath) {
|
|
11
|
+
let fileName = (0, __stryke_path_normalize.correctPath)((0, __stryke_path_find.relative)(dir, filePath));
|
|
12
|
+
if (!fileName.startsWith(".")) fileName = `./${fileName}`;
|
|
13
|
+
let output = `\n${fileName}`;
|
|
14
|
+
for (let i = 0; i < messages.length; i++) {
|
|
15
|
+
const { message, severity, line, column, ruleId } = messages[i];
|
|
16
|
+
output += "\n";
|
|
17
|
+
if (line && column) output = `${output + line.toString()}:${column.toString()} `;
|
|
18
|
+
if (severity === MessageSeverity.Warning) output += `Warning: `;
|
|
19
|
+
else output += `Error: `;
|
|
20
|
+
output += message;
|
|
21
|
+
if (ruleId) output += ` ${ruleId}`;
|
|
22
|
+
}
|
|
23
|
+
return output;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.MessageSeverity = MessageSeverity;
|
|
28
|
+
exports.formatMessage = formatMessage;
|
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
import{relative
|
|
2
|
-
|
|
1
|
+
import { relative } from "@stryke/path/find";
|
|
2
|
+
import { correctPath } from "@stryke/path/normalize";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/format-message.ts
|
|
5
|
+
let MessageSeverity = /* @__PURE__ */ function(MessageSeverity$1) {
|
|
6
|
+
MessageSeverity$1[MessageSeverity$1["Warning"] = 1] = "Warning";
|
|
7
|
+
MessageSeverity$1[MessageSeverity$1["Error"] = 2] = "Error";
|
|
8
|
+
return MessageSeverity$1;
|
|
9
|
+
}({});
|
|
10
|
+
function formatMessage(dir, messages, filePath) {
|
|
11
|
+
let fileName = correctPath(relative(dir, filePath));
|
|
12
|
+
if (!fileName.startsWith(".")) fileName = `./${fileName}`;
|
|
13
|
+
let output = `\n${fileName}`;
|
|
14
|
+
for (let i = 0; i < messages.length; i++) {
|
|
15
|
+
const { message, severity, line, column, ruleId } = messages[i];
|
|
16
|
+
output += "\n";
|
|
17
|
+
if (line && column) output = `${output + line.toString()}:${column.toString()} `;
|
|
18
|
+
if (severity === MessageSeverity.Warning) output += `Warning: `;
|
|
19
|
+
else output += `Error: `;
|
|
20
|
+
output += message;
|
|
21
|
+
if (ruleId) output += ` ${ruleId}`;
|
|
22
|
+
}
|
|
23
|
+
return output;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { MessageSeverity, formatMessage };
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_helpers_format_message = require('./format-message.cjs');
|
|
2
|
+
|
|
3
|
+
exports.MessageSeverity = require_helpers_format_message.MessageSeverity;
|
|
4
|
+
exports.formatMessage = require_helpers_format_message.formatMessage;
|
package/dist/helpers/index.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,108 @@
|
|
|
1
|
-
Object.defineProperty(exports
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_helpers_format_message = require('./helpers/format-message.cjs');
|
|
3
|
+
require('./helpers/index.cjs');
|
|
4
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
5
|
+
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
6
|
+
let __stryke_fs_get_parent_path = require("@stryke/fs/get-parent-path");
|
|
7
|
+
let __stryke_fs_package_fns = require("@stryke/fs/package-fns");
|
|
8
|
+
let __stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
9
|
+
let __stryke_fs_semver_fns = require("@stryke/fs/semver-fns");
|
|
10
|
+
let __stryke_path_find = require("@stryke/path/find");
|
|
11
|
+
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
12
|
+
let defu = require("defu");
|
|
13
|
+
|
|
14
|
+
//#region src/index.ts
|
|
15
|
+
/**
|
|
16
|
+
* A Powerlines plugin to lint a project's source code with ESLint.
|
|
17
|
+
*/
|
|
18
|
+
function plugin(options = {}) {
|
|
19
|
+
return {
|
|
20
|
+
name: "eslint",
|
|
21
|
+
async config() {
|
|
22
|
+
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `eslint` build plugin.");
|
|
23
|
+
return { lint: { eslint: (0, defu.defu)(options, {
|
|
24
|
+
configFile: (0, __stryke_fs_get_parent_path.getParentPath)([
|
|
25
|
+
"eslint.config.js",
|
|
26
|
+
"eslint.config.mjs",
|
|
27
|
+
"eslint.config.cjs",
|
|
28
|
+
"eslint.config.ts",
|
|
29
|
+
"eslint.config.mts",
|
|
30
|
+
"eslint.config.cts",
|
|
31
|
+
".eslintrc.js",
|
|
32
|
+
".eslintrc.cjs",
|
|
33
|
+
".eslintrc.yaml",
|
|
34
|
+
".eslintrc.yml",
|
|
35
|
+
".eslintrc.json",
|
|
36
|
+
".eslintrc"
|
|
37
|
+
], this.config.projectRoot, {
|
|
38
|
+
ignoreCase: true,
|
|
39
|
+
skipCwd: false,
|
|
40
|
+
includeNameInResults: true
|
|
41
|
+
}),
|
|
42
|
+
reportErrorsOnly: false,
|
|
43
|
+
maxWarnings: 5,
|
|
44
|
+
fix: true,
|
|
45
|
+
outputFile: null,
|
|
46
|
+
type: "recommended"
|
|
47
|
+
}) } };
|
|
48
|
+
},
|
|
49
|
+
async configResolved() {
|
|
50
|
+
if (!(0, __stryke_type_checks_is_set_object.isSetObject)(this.packageJson.eslintConfig) && (!this.config.lint.eslint.configFile || !(0, __stryke_fs_exists.existsSync)(this.config.lint.eslint.configFile))) throw new Error("No ESLint configuration file could be found");
|
|
51
|
+
else if (this.config.lint.eslint.configFile && (0, __stryke_fs_exists.existsSync)(this.config.lint.eslint.configFile)) {
|
|
52
|
+
const content = await (0, __stryke_fs_read_file.readFile)(this.config.lint.eslint.configFile);
|
|
53
|
+
if (content?.trim().replace(/\s/g, "") || content?.trim().replace(/\s/g, "") === "---" || content?.trim().replace(/\s/g, "") === "{}" || content?.trim().replace(/\s/g, "") === "module.exports={}") throw new Error(`The ESLint configuration file at "${this.config.lint.eslint.configFile}" is empty`);
|
|
54
|
+
}
|
|
55
|
+
if (!(0, __stryke_fs_package_fns.isPackageExists)("eslint", { paths: [this.workspaceConfig.workspaceRoot, this.config.projectRoot] })) throw new Error(`ESLint must be installed to use the Powerlines ESLint plugin. Please run: npm install --save-dev eslint`);
|
|
56
|
+
const module$1 = await this.resolver.import(this.resolver.esmResolve("eslint"));
|
|
57
|
+
const useFlatConfig = this.config.lint.eslint.configFile ? (0, __stryke_path_find.findFileName)(this.config.lint.eslint.configFile).startsWith("eslint.config.") : true;
|
|
58
|
+
let ESLint;
|
|
59
|
+
if ("loadESLint" in module$1) ESLint = await module$1.loadESLint({ useFlatConfig });
|
|
60
|
+
const eslintVersion = (0, __stryke_fs_semver_fns.parseVersion)(ESLint?.version);
|
|
61
|
+
if (!eslintVersion || eslintVersion.compare("8.57.0") < 0) throw new Error(`Error - Your project has an older version of ESLint installed${eslintVersion ? ` (${eslintVersion.major}.${eslintVersion.minor}.${eslintVersion.patch})` : ""}. Please upgrade to ESLint version 8.57.0 or above`);
|
|
62
|
+
const options$1 = {
|
|
63
|
+
useEslintrc: !useFlatConfig,
|
|
64
|
+
baseConfig: {},
|
|
65
|
+
errorOnUnmatchedPattern: false,
|
|
66
|
+
extensions: [
|
|
67
|
+
".js",
|
|
68
|
+
".jsx",
|
|
69
|
+
".ts",
|
|
70
|
+
".tsx"
|
|
71
|
+
],
|
|
72
|
+
cache: true
|
|
73
|
+
};
|
|
74
|
+
if (eslintVersion?.compare("9.0.0") && useFlatConfig) {
|
|
75
|
+
for (const option of [
|
|
76
|
+
"useEslintrc",
|
|
77
|
+
"extensions",
|
|
78
|
+
"ignorePath",
|
|
79
|
+
"reportUnusedDisableDirectives",
|
|
80
|
+
"resolvePluginsRelativeTo",
|
|
81
|
+
"rulePaths",
|
|
82
|
+
"inlineConfig",
|
|
83
|
+
"maxWarnings"
|
|
84
|
+
]) if (option in options$1) delete options$1[option];
|
|
85
|
+
}
|
|
86
|
+
this.eslint = new ESLint(options$1);
|
|
87
|
+
},
|
|
88
|
+
async lint() {
|
|
89
|
+
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Linting project files with ESLint.`);
|
|
90
|
+
let results = await this.eslint.lintFiles(this.tsconfig.fileNames.filter((fileName) => !fileName.includes(this.artifactsPath) && !fileName.includes("node_modules")));
|
|
91
|
+
const module$1 = await this.resolver.import(this.resolver.esmResolve("eslint"));
|
|
92
|
+
let ESLint;
|
|
93
|
+
if ("loadESLint" in module$1) ESLint = await module$1.loadESLint({ useFlatConfig: this.config.lint.eslint.configFile ? (0, __stryke_path_find.findFileName)(this.config.lint.eslint.configFile).startsWith("eslint.config.") : true });
|
|
94
|
+
if (this.config.lint.eslint.fix) await ESLint.outputFixes(results);
|
|
95
|
+
if (this.config.lint.eslint.reportErrorsOnly) results = ESLint.getErrorResults(results);
|
|
96
|
+
const output = results.filter(({ messages }) => messages?.length).map(({ messages, filePath }) => require_helpers_format_message.formatMessage(this.config.projectRoot, messages, filePath)).join("\n");
|
|
97
|
+
if (this.config.lint.eslint.outputFile) await this.fs.write(this.config.lint.eslint.outputFile, output);
|
|
98
|
+
else this.log(__storm_software_config_tools_types.LogLevelLabel.INFO, output);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
var src_default = plugin;
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
exports.MessageSeverity = require_helpers_format_message.MessageSeverity;
|
|
106
|
+
exports.default = src_default;
|
|
107
|
+
exports.formatMessage = require_helpers_format_message.formatMessage;
|
|
108
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,104 @@
|
|
|
1
|
-
import{MessageSeverity
|
|
2
|
-
|
|
1
|
+
import { MessageSeverity, formatMessage } from "./helpers/format-message.mjs";
|
|
2
|
+
import "./helpers/index.mjs";
|
|
3
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
4
|
+
import { existsSync } from "@stryke/fs/exists";
|
|
5
|
+
import { getParentPath } from "@stryke/fs/get-parent-path";
|
|
6
|
+
import { isPackageExists } from "@stryke/fs/package-fns";
|
|
7
|
+
import { readFile } from "@stryke/fs/read-file";
|
|
8
|
+
import { parseVersion } from "@stryke/fs/semver-fns";
|
|
9
|
+
import { findFileName } from "@stryke/path/find";
|
|
10
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
11
|
+
import { defu } from "defu";
|
|
12
|
+
|
|
13
|
+
//#region src/index.ts
|
|
14
|
+
/**
|
|
15
|
+
* A Powerlines plugin to lint a project's source code with ESLint.
|
|
16
|
+
*/
|
|
17
|
+
function plugin(options = {}) {
|
|
18
|
+
return {
|
|
19
|
+
name: "eslint",
|
|
20
|
+
async config() {
|
|
21
|
+
this.log(LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `eslint` build plugin.");
|
|
22
|
+
return { lint: { eslint: defu(options, {
|
|
23
|
+
configFile: getParentPath([
|
|
24
|
+
"eslint.config.js",
|
|
25
|
+
"eslint.config.mjs",
|
|
26
|
+
"eslint.config.cjs",
|
|
27
|
+
"eslint.config.ts",
|
|
28
|
+
"eslint.config.mts",
|
|
29
|
+
"eslint.config.cts",
|
|
30
|
+
".eslintrc.js",
|
|
31
|
+
".eslintrc.cjs",
|
|
32
|
+
".eslintrc.yaml",
|
|
33
|
+
".eslintrc.yml",
|
|
34
|
+
".eslintrc.json",
|
|
35
|
+
".eslintrc"
|
|
36
|
+
], this.config.projectRoot, {
|
|
37
|
+
ignoreCase: true,
|
|
38
|
+
skipCwd: false,
|
|
39
|
+
includeNameInResults: true
|
|
40
|
+
}),
|
|
41
|
+
reportErrorsOnly: false,
|
|
42
|
+
maxWarnings: 5,
|
|
43
|
+
fix: true,
|
|
44
|
+
outputFile: null,
|
|
45
|
+
type: "recommended"
|
|
46
|
+
}) } };
|
|
47
|
+
},
|
|
48
|
+
async configResolved() {
|
|
49
|
+
if (!isSetObject(this.packageJson.eslintConfig) && (!this.config.lint.eslint.configFile || !existsSync(this.config.lint.eslint.configFile))) throw new Error("No ESLint configuration file could be found");
|
|
50
|
+
else if (this.config.lint.eslint.configFile && existsSync(this.config.lint.eslint.configFile)) {
|
|
51
|
+
const content = await readFile(this.config.lint.eslint.configFile);
|
|
52
|
+
if (content?.trim().replace(/\s/g, "") || content?.trim().replace(/\s/g, "") === "---" || content?.trim().replace(/\s/g, "") === "{}" || content?.trim().replace(/\s/g, "") === "module.exports={}") throw new Error(`The ESLint configuration file at "${this.config.lint.eslint.configFile}" is empty`);
|
|
53
|
+
}
|
|
54
|
+
if (!isPackageExists("eslint", { paths: [this.workspaceConfig.workspaceRoot, this.config.projectRoot] })) throw new Error(`ESLint must be installed to use the Powerlines ESLint plugin. Please run: npm install --save-dev eslint`);
|
|
55
|
+
const module = await this.resolver.import(this.resolver.esmResolve("eslint"));
|
|
56
|
+
const useFlatConfig = this.config.lint.eslint.configFile ? findFileName(this.config.lint.eslint.configFile).startsWith("eslint.config.") : true;
|
|
57
|
+
let ESLint;
|
|
58
|
+
if ("loadESLint" in module) ESLint = await module.loadESLint({ useFlatConfig });
|
|
59
|
+
const eslintVersion = parseVersion(ESLint?.version);
|
|
60
|
+
if (!eslintVersion || eslintVersion.compare("8.57.0") < 0) throw new Error(`Error - Your project has an older version of ESLint installed${eslintVersion ? ` (${eslintVersion.major}.${eslintVersion.minor}.${eslintVersion.patch})` : ""}. Please upgrade to ESLint version 8.57.0 or above`);
|
|
61
|
+
const options$1 = {
|
|
62
|
+
useEslintrc: !useFlatConfig,
|
|
63
|
+
baseConfig: {},
|
|
64
|
+
errorOnUnmatchedPattern: false,
|
|
65
|
+
extensions: [
|
|
66
|
+
".js",
|
|
67
|
+
".jsx",
|
|
68
|
+
".ts",
|
|
69
|
+
".tsx"
|
|
70
|
+
],
|
|
71
|
+
cache: true
|
|
72
|
+
};
|
|
73
|
+
if (eslintVersion?.compare("9.0.0") && useFlatConfig) {
|
|
74
|
+
for (const option of [
|
|
75
|
+
"useEslintrc",
|
|
76
|
+
"extensions",
|
|
77
|
+
"ignorePath",
|
|
78
|
+
"reportUnusedDisableDirectives",
|
|
79
|
+
"resolvePluginsRelativeTo",
|
|
80
|
+
"rulePaths",
|
|
81
|
+
"inlineConfig",
|
|
82
|
+
"maxWarnings"
|
|
83
|
+
]) if (option in options$1) delete options$1[option];
|
|
84
|
+
}
|
|
85
|
+
this.eslint = new ESLint(options$1);
|
|
86
|
+
},
|
|
87
|
+
async lint() {
|
|
88
|
+
this.log(LogLevelLabel.TRACE, `Linting project files with ESLint.`);
|
|
89
|
+
let results = await this.eslint.lintFiles(this.tsconfig.fileNames.filter((fileName) => !fileName.includes(this.artifactsPath) && !fileName.includes("node_modules")));
|
|
90
|
+
const module = await this.resolver.import(this.resolver.esmResolve("eslint"));
|
|
91
|
+
let ESLint;
|
|
92
|
+
if ("loadESLint" in module) ESLint = await module.loadESLint({ useFlatConfig: this.config.lint.eslint.configFile ? findFileName(this.config.lint.eslint.configFile).startsWith("eslint.config.") : true });
|
|
93
|
+
if (this.config.lint.eslint.fix) await ESLint.outputFixes(results);
|
|
94
|
+
if (this.config.lint.eslint.reportErrorsOnly) results = ESLint.getErrorResults(results);
|
|
95
|
+
const output = results.filter(({ messages }) => messages?.length).map(({ messages, filePath }) => formatMessage(this.config.projectRoot, messages, filePath)).join("\n");
|
|
96
|
+
if (this.config.lint.eslint.outputFile) await this.fs.write(this.config.lint.eslint.outputFile, output);
|
|
97
|
+
else this.log(LogLevelLabel.INFO, output);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
var src_default = plugin;
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
export { MessageSeverity, src_default as default, formatMessage, plugin };
|
|
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
78
78
|
*/
|
|
79
79
|
allowReturnOutsideFunction?: boolean;
|
|
80
80
|
}
|
|
81
|
+
interface EmitOptions extends WriteOptions {
|
|
82
|
+
/**
|
|
83
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
84
|
+
*/
|
|
85
|
+
emitWithBundler?: boolean;
|
|
86
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
87
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
88
|
+
}
|
|
81
89
|
/**
|
|
82
90
|
* Options for emitting entry virtual files
|
|
83
91
|
*/
|
|
84
|
-
type EmitEntryOptions =
|
|
92
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
85
93
|
/**
|
|
86
94
|
* The unresolved Powerlines context.
|
|
87
95
|
*
|
|
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
292
300
|
* The Powerlines builtin virtual files
|
|
293
301
|
*/
|
|
294
302
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
303
|
+
/**
|
|
304
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
305
|
+
*
|
|
306
|
+
* @param code - The source code of the file
|
|
307
|
+
* @param path - The path to write the file to
|
|
308
|
+
* @param options - Additional options for writing the file
|
|
309
|
+
*/
|
|
310
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
313
|
+
*
|
|
314
|
+
* @param code - The source code of the file
|
|
315
|
+
* @param path - The path to write the file to
|
|
316
|
+
* @param options - Additional options for writing the file
|
|
317
|
+
*/
|
|
318
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
295
319
|
/**
|
|
296
320
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
297
321
|
*
|
|
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
300
324
|
* @param path - An optional path to write the builtin file to
|
|
301
325
|
* @param options - Additional options for writing the builtin file
|
|
302
326
|
*/
|
|
303
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
327
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
304
328
|
/**
|
|
305
329
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
306
330
|
*
|
|
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
309
333
|
* @param path - An optional path to write the builtin file to
|
|
310
334
|
* @param options - Additional options for writing the builtin file
|
|
311
335
|
*/
|
|
312
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
336
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
313
337
|
/**
|
|
314
338
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
315
339
|
*
|
|
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
80
80
|
*/
|
|
81
81
|
allowReturnOutsideFunction?: boolean;
|
|
82
82
|
}
|
|
83
|
+
interface EmitOptions extends WriteOptions {
|
|
84
|
+
/**
|
|
85
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
86
|
+
*/
|
|
87
|
+
emitWithBundler?: boolean;
|
|
88
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
89
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
90
|
+
}
|
|
83
91
|
/**
|
|
84
92
|
* Options for emitting entry virtual files
|
|
85
93
|
*/
|
|
86
|
-
type EmitEntryOptions =
|
|
94
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
87
95
|
/**
|
|
88
96
|
* The unresolved Powerlines context.
|
|
89
97
|
*
|
|
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
294
302
|
* The Powerlines builtin virtual files
|
|
295
303
|
*/
|
|
296
304
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
305
|
+
/**
|
|
306
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
307
|
+
*
|
|
308
|
+
* @param code - The source code of the file
|
|
309
|
+
* @param path - The path to write the file to
|
|
310
|
+
* @param options - Additional options for writing the file
|
|
311
|
+
*/
|
|
312
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
315
|
+
*
|
|
316
|
+
* @param code - The source code of the file
|
|
317
|
+
* @param path - The path to write the file to
|
|
318
|
+
* @param options - Additional options for writing the file
|
|
319
|
+
*/
|
|
320
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
297
321
|
/**
|
|
298
322
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
299
323
|
*
|
|
@@ -302,7 +326,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
302
326
|
* @param path - An optional path to write the builtin file to
|
|
303
327
|
* @param options - Additional options for writing the builtin file
|
|
304
328
|
*/
|
|
305
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
329
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
306
330
|
/**
|
|
307
331
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
308
332
|
*
|
|
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
311
335
|
* @param path - An optional path to write the builtin file to
|
|
312
336
|
* @param options - Additional options for writing the builtin file
|
|
313
337
|
*/
|
|
314
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
338
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
315
339
|
/**
|
|
316
340
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
317
341
|
*
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-eslint",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.122",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for running ESLint on the codebase.",
|
|
6
6
|
"repository": {
|
|
@@ -101,17 +101,17 @@
|
|
|
101
101
|
"keywords": ["eslint", "powerlines", "storm-software", "powerlines-plugin"],
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@storm-software/config-tools": "^1.188.74",
|
|
104
|
-
"@stryke/fs": "^0.33.
|
|
105
|
-
"@stryke/path": "^0.24.
|
|
104
|
+
"@stryke/fs": "^0.33.27",
|
|
105
|
+
"@stryke/path": "^0.24.1",
|
|
106
106
|
"defu": "^6.1.4",
|
|
107
107
|
"eslint": "^9.39.2",
|
|
108
|
-
"powerlines": "^0.36.
|
|
108
|
+
"powerlines": "^0.36.23"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@powerlines/nx": "^0.11.
|
|
111
|
+
"@powerlines/nx": "^0.11.49",
|
|
112
112
|
"@storm-software/tsup": "^0.2.72",
|
|
113
113
|
"@types/node": "^24.10.4"
|
|
114
114
|
},
|
|
115
115
|
"publishConfig": { "access": "public" },
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
|
|
117
117
|
}
|