@pi-r/eslint 0.11.3 → 0.12.2

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.
Files changed (2) hide show
  1. package/index.js +9 -7
  2. package/package.json +4 -7
package/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
- const path = require("node:path");
3
- const Document = require("@e-mc/document");
4
- const eslint_1 = require("eslint");
5
- module.exports = async function transform(context, value, options) {
2
+
3
+ const path = require('node:path');
4
+ const { ESLint } = require('eslint');
5
+ const Document = require('@e-mc/document');
6
+ async function transform(context, value, options) {
6
7
  context = options.upgrade(context, __dirname);
7
8
  const { pathname, filename } = options;
8
9
  const timeStamp = Date.now();
9
10
  const baseConfig = options.toBaseConfig();
10
- const ESLint = ((process.env.ESLINT_USE_FLAT_CONFIG === 'true' || options.version.startsWith('9.')) && !context.ESLint.version.startsWith('9.') ? await (0, eslint_1.loadESLint)({ useFlatConfig: true }) : (process.env.ESLINT_USE_FLAT_CONFIG === 'false' || options.version.startsWith('8.')) && !context.ESLint.version.startsWith('8.') ? await (0, eslint_1.loadESLint)({ useFlatConfig: false }) : context.ESLint);
11
- const instance = new ESLint(baseConfig);
11
+ const instance = options.version.startsWith('10') && !context.ESLint.version.startsWith('10.') ? new ESLint(baseConfig) : new context.ESLint(baseConfig);
12
12
  const result = await instance.lintText(value, { filePath: pathname && filename && path.join(pathname, filename) });
13
13
  if (result.length > 0) {
14
14
  if (baseConfig.fix) {
@@ -49,4 +49,6 @@ module.exports = async function transform(context, value, options) {
49
49
  }
50
50
  }
51
51
  return value;
52
- };
52
+ }
53
+
54
+ module.exports = transform;
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "@pi-r/eslint",
3
- "version": "0.11.3",
3
+ "version": "0.12.2",
4
4
  "description": "ESLint transform function for E-mc.",
5
5
  "main": "index.js",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
6
  "repository": {
10
7
  "type": "git",
11
8
  "url": "git+https://github.com/anpham6/pi-r.git",
@@ -19,8 +16,8 @@
19
16
  "license": "MIT",
20
17
  "homepage": "https://github.com/anpham6/pi-r#readme",
21
18
  "dependencies": {
22
- "@e-mc/document": "^0.13.10",
23
- "@eslint/js": "^9.39.4",
24
- "eslint": "^9.39.4"
19
+ "@e-mc/document": "^0.14.3",
20
+ "@eslint/js": "^10.0.1",
21
+ "eslint": "^10.5.0"
25
22
  }
26
23
  }