refactor start

This commit is contained in:
Spectre 2025-02-18 11:19:45 +01:00
parent bd49791e06
commit e46d25f0b7
16699 changed files with 2 additions and 1484887 deletions

View file

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Yosuke Ota
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,48 +0,0 @@
# eslint-compat-utils
***This package is still in the experimental stage.***
Provides an API for ESLint custom rules that is compatible with the latest ESLint even when using older ESLint.
## Installation
```bash
npm install eslint-compat-utils
```
## Usage
```js
const { getSourceCode } = require("eslint-compat-utils");
module.exports = {
meta: { /* ... */ },
create(context) {
const sourceCode = getSourceCode(context)
return {
"Program"(node) {
const scope = sourceCode.getScope(node);
},
};
},
}
```
### API
#### `getSourceCode(context)`
Returns an extended instance of `context.sourceCode` or the result of `context.getSourceCode()`. Extended instances can use new APIs such as `getScope(node)` even with old ESLint.
#### `getCwd(context)`
Gets the value of `context.cwd`, but for older ESLint it returns the result of `context.getCwd()`.
Versions older than v6.6.0 return a value from the result of `process.cwd()`.
#### `getFilename(context)`
Gets the value of `context.filename`, but for older ESLint it returns the result of `context.getFilename()`.
#### `getPhysicalFilename(context)`
Gets the value of `context.physicalFilename`, but for older ESLint it returns the result of `context.getPhysicalFilename()`.
Versions older than v7.28.0 return a value guessed from the result of `context.getFilename()`, but it may be incorrect.

View file

@ -1,178 +0,0 @@
'use strict';
const eslint = require('eslint');
const semver = require('semver');
const convertConfig = require('./shared/eslint-compat-utils.503aeaae.cjs');
const getUnsupported = require('./shared/eslint-compat-utils.cb53cf36.cjs');
require('module');
function _interopNamespaceCompat(e) {
if (e && typeof e === 'object' && 'default' in e) return e;
const n = Object.create(null);
if (e) {
for (const k in e) {
n[k] = e[k];
}
}
n.default = e;
return n;
}
const eslint__namespace = /*#__PURE__*/_interopNamespaceCompat(eslint);
const semver__namespace = /*#__PURE__*/_interopNamespaceCompat(semver);
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let cacheESLint, cacheLegacyESLint;
function getESLint() {
return cacheESLint != null ? cacheESLint : cacheESLint = getESLintInternal();
function getESLintInternal() {
if (semver__namespace.gte(eslint__namespace.Linter.version, "9.0.0-0")) {
return eslint__namespace.ESLint;
}
return getUnsupported.getUnsupported().FlatESLint || (eslint__namespace.ESLint ? getESLintClassFromLegacyESLint(eslint__namespace.ESLint) : getESLintClassFromLegacyESLint(getLegacyESLintClassFromCLIEngine()));
}
}
function getLegacyESLint() {
return cacheLegacyESLint != null ? cacheLegacyESLint : cacheLegacyESLint = getLegacyESLintInternal();
function getLegacyESLintInternal() {
return getUnsupported.getUnsupported().LegacyESLint || eslint__namespace.ESLint || getLegacyESLintClassFromCLIEngine();
}
}
function getESLintClassFromLegacyESLint(legacyESLintClass) {
return class ESLintFromLegacyESLint extends legacyESLintClass {
static get version() {
return legacyESLintClass.version;
}
constructor(options) {
super(adjustOptions(options));
}
};
function adjustOptions(options) {
const {
baseConfig: originalBaseConfig,
overrideConfig: originalOverrideConfig,
overrideConfigFile,
...newOptions
} = options || {};
if (originalBaseConfig) {
const [baseConfig, plugins] = convertConfig$1(originalBaseConfig);
newOptions.baseConfig = baseConfig;
if (plugins) {
newOptions.plugins = plugins;
}
}
if (originalOverrideConfig) {
const [overrideConfig, plugins] = convertConfig$1(originalOverrideConfig);
newOptions.overrideConfig = overrideConfig;
if (plugins) {
newOptions.plugins = plugins;
}
}
if (overrideConfigFile) {
if (overrideConfigFile === true) {
newOptions.useEslintrc = false;
} else {
newOptions.overrideConfigFile = overrideConfigFile;
}
}
return newOptions;
}
function convertConfig$1(config) {
const pluginDefs = {};
const newConfigs = [];
for (const configItem of Array.isArray(config) ? config : [config]) {
const { plugins, ...otherConfig } = configItem;
if (typeof otherConfig.processor !== "string")
delete otherConfig.processor;
const newConfig = {
files: ["**/*.*", "*.*", "**/*", "*"],
...convertConfig.convertConfigToRc(otherConfig)
};
if (plugins) {
newConfig.plugins = Object.keys(plugins);
}
Object.assign(pluginDefs, plugins);
newConfigs.push(newConfig);
}
return [{ overrides: newConfigs }, pluginDefs];
}
}
function getLegacyESLintClassFromCLIEngine() {
const CLIEngine = eslint__namespace.CLIEngine;
class LegacyESLintFromCLIEngine {
constructor(options) {
__publicField(this, "engine");
const {
overrideConfig: {
plugins,
globals,
rules,
overrides,
...overrideConfig
} = {
plugins: [],
globals: {},
rules: {},
overrides: []
},
fix,
reportUnusedDisableDirectives,
plugins: pluginsMap,
...otherOptions
} = options || {};
const cliEngineOptions = {
baseConfig: {
...overrides ? {
overrides
} : {}
},
fix: Boolean(fix),
reportUnusedDisableDirectives: reportUnusedDisableDirectives ? reportUnusedDisableDirectives !== "off" : void 0,
...otherOptions,
globals: globals ? Object.keys(globals).filter((n) => globals[n]) : void 0,
plugins: plugins || [],
rules: rules ? Object.fromEntries(
Object.entries(rules).flatMap(
([ruleId, opt]) => opt ? [[ruleId, opt]] : []
)
) : void 0,
...overrideConfig
};
this.engine = new CLIEngine(cliEngineOptions);
for (const [name, plugin] of Object.entries(pluginsMap || {})) {
this.engine.addPlugin(name, plugin);
}
}
static get version() {
return CLIEngine.version;
}
// eslint-disable-next-line @typescript-eslint/require-await -- ignore
async lintText(...params) {
var _a;
const result = this.engine.executeOnText(params[0], (_a = params[1]) == null ? void 0 : _a.filePath);
return result.results;
}
// eslint-disable-next-line @typescript-eslint/require-await -- ignore
async lintFiles(...params) {
const result = this.engine.executeOnFiles(
Array.isArray(params[0]) ? params[0] : [params[0]]
);
return result.results;
}
// eslint-disable-next-line @typescript-eslint/require-await -- ignore
static async outputFixes(...params) {
return CLIEngine.outputFixes({
results: params[0]
});
}
}
return LegacyESLintFromCLIEngine;
}
exports.getESLint = getESLint;
exports.getLegacyESLint = getLegacyESLint;

View file

@ -1,12 +0,0 @@
import * as eslint from 'eslint';
/**
* Get ESLint class
*/
declare function getESLint(): typeof eslint.ESLint;
/**
* Get LegacyESLint class
*/
declare function getLegacyESLint(): typeof eslint.ESLint;
export { getESLint, getLegacyESLint };

View file

@ -1,12 +0,0 @@
import * as eslint from 'eslint';
/**
* Get ESLint class
*/
declare function getESLint(): typeof eslint.ESLint;
/**
* Get LegacyESLint class
*/
declare function getLegacyESLint(): typeof eslint.ESLint;
export { getESLint, getLegacyESLint };

View file

@ -1,12 +0,0 @@
import * as eslint from 'eslint';
/**
* Get ESLint class
*/
declare function getESLint(): typeof eslint.ESLint;
/**
* Get LegacyESLint class
*/
declare function getLegacyESLint(): typeof eslint.ESLint;
export { getESLint, getLegacyESLint };

View file

@ -1,160 +0,0 @@
import * as eslint from 'eslint';
import * as semver from 'semver';
import { c as convertConfigToRc } from './shared/eslint-compat-utils.1a5060cf.mjs';
import { g as getUnsupported } from './shared/eslint-compat-utils.3ecba7ac.mjs';
import 'module';
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let cacheESLint, cacheLegacyESLint;
function getESLint() {
return cacheESLint != null ? cacheESLint : cacheESLint = getESLintInternal();
function getESLintInternal() {
if (semver.gte(eslint.Linter.version, "9.0.0-0")) {
return eslint.ESLint;
}
return getUnsupported().FlatESLint || (eslint.ESLint ? getESLintClassFromLegacyESLint(eslint.ESLint) : getESLintClassFromLegacyESLint(getLegacyESLintClassFromCLIEngine()));
}
}
function getLegacyESLint() {
return cacheLegacyESLint != null ? cacheLegacyESLint : cacheLegacyESLint = getLegacyESLintInternal();
function getLegacyESLintInternal() {
return getUnsupported().LegacyESLint || eslint.ESLint || getLegacyESLintClassFromCLIEngine();
}
}
function getESLintClassFromLegacyESLint(legacyESLintClass) {
return class ESLintFromLegacyESLint extends legacyESLintClass {
static get version() {
return legacyESLintClass.version;
}
constructor(options) {
super(adjustOptions(options));
}
};
function adjustOptions(options) {
const {
baseConfig: originalBaseConfig,
overrideConfig: originalOverrideConfig,
overrideConfigFile,
...newOptions
} = options || {};
if (originalBaseConfig) {
const [baseConfig, plugins] = convertConfig(originalBaseConfig);
newOptions.baseConfig = baseConfig;
if (plugins) {
newOptions.plugins = plugins;
}
}
if (originalOverrideConfig) {
const [overrideConfig, plugins] = convertConfig(originalOverrideConfig);
newOptions.overrideConfig = overrideConfig;
if (plugins) {
newOptions.plugins = plugins;
}
}
if (overrideConfigFile) {
if (overrideConfigFile === true) {
newOptions.useEslintrc = false;
} else {
newOptions.overrideConfigFile = overrideConfigFile;
}
}
return newOptions;
}
function convertConfig(config) {
const pluginDefs = {};
const newConfigs = [];
for (const configItem of Array.isArray(config) ? config : [config]) {
const { plugins, ...otherConfig } = configItem;
if (typeof otherConfig.processor !== "string")
delete otherConfig.processor;
const newConfig = {
files: ["**/*.*", "*.*", "**/*", "*"],
...convertConfigToRc(otherConfig)
};
if (plugins) {
newConfig.plugins = Object.keys(plugins);
}
Object.assign(pluginDefs, plugins);
newConfigs.push(newConfig);
}
return [{ overrides: newConfigs }, pluginDefs];
}
}
function getLegacyESLintClassFromCLIEngine() {
const CLIEngine = eslint.CLIEngine;
class LegacyESLintFromCLIEngine {
constructor(options) {
__publicField(this, "engine");
const {
overrideConfig: {
plugins,
globals,
rules,
overrides,
...overrideConfig
} = {
plugins: [],
globals: {},
rules: {},
overrides: []
},
fix,
reportUnusedDisableDirectives,
plugins: pluginsMap,
...otherOptions
} = options || {};
const cliEngineOptions = {
baseConfig: {
...overrides ? {
overrides
} : {}
},
fix: Boolean(fix),
reportUnusedDisableDirectives: reportUnusedDisableDirectives ? reportUnusedDisableDirectives !== "off" : void 0,
...otherOptions,
globals: globals ? Object.keys(globals).filter((n) => globals[n]) : void 0,
plugins: plugins || [],
rules: rules ? Object.fromEntries(
Object.entries(rules).flatMap(
([ruleId, opt]) => opt ? [[ruleId, opt]] : []
)
) : void 0,
...overrideConfig
};
this.engine = new CLIEngine(cliEngineOptions);
for (const [name, plugin] of Object.entries(pluginsMap || {})) {
this.engine.addPlugin(name, plugin);
}
}
static get version() {
return CLIEngine.version;
}
// eslint-disable-next-line @typescript-eslint/require-await -- ignore
async lintText(...params) {
var _a;
const result = this.engine.executeOnText(params[0], (_a = params[1]) == null ? void 0 : _a.filePath);
return result.results;
}
// eslint-disable-next-line @typescript-eslint/require-await -- ignore
async lintFiles(...params) {
const result = this.engine.executeOnFiles(
Array.isArray(params[0]) ? params[0] : [params[0]]
);
return result.results;
}
// eslint-disable-next-line @typescript-eslint/require-await -- ignore
static async outputFixes(...params) {
return CLIEngine.outputFixes({
results: params[0]
});
}
}
return LegacyESLintFromCLIEngine;
}
export { getESLint, getLegacyESLint };

View file

@ -1,126 +0,0 @@
'use strict';
const path = require('path');
const fs = require('fs');
function applyPolyfills(object, polyfill) {
return new Proxy(object, {
get(_target, p) {
var _a;
return (_a = object[p]) != null ? _a : polyfill[p];
}
});
}
function getParent(node) {
return node.parent;
}
const cache = /* @__PURE__ */ new WeakMap();
function getSourceCode(context) {
const original = context.sourceCode || context.getSourceCode();
const cached = cache.get(original);
if (cached) {
return cached;
}
const sourceCode = applyPolyfills(original, {
getScope(node) {
const inner = node.type !== "Program";
for (let n = node; n; n = getParent(n)) {
const scope = original.scopeManager.acquire(n, inner);
if (scope) {
if (scope.type === "function-expression-name") {
return scope.childScopes[0];
}
return scope;
}
}
return original.scopeManager.scopes[0];
},
markVariableAsUsed(name, refNode = original.ast) {
const currentScope = sourceCode.getScope(refNode);
if (currentScope === context.getScope()) {
return context.markVariableAsUsed(name);
}
let initialScope = currentScope;
if (currentScope.type === "global" && currentScope.childScopes.length > 0 && currentScope.childScopes[0].block === original.ast) {
initialScope = currentScope.childScopes[0];
}
for (let scope = initialScope; scope; scope = scope.upper) {
const variable = scope.variables.find(
(scopeVar) => scopeVar.name === name
);
if (variable) {
variable.eslintUsed = true;
return true;
}
}
return false;
},
getAncestors(node) {
const result = [];
for (let ancestor = getParent(node); ancestor; ancestor = ancestor.parent) {
result.unshift(ancestor);
}
return result;
},
getDeclaredVariables(node) {
return original.scopeManager.getDeclaredVariables(node);
},
isSpaceBetween(first, second) {
if (first.range[0] <= second.range[1] && second.range[0] <= first.range[1]) {
return false;
}
const [startingNodeOrToken, endingNodeOrToken] = first.range[1] <= second.range[0] ? [first, second] : [second, first];
const tokens = sourceCode.getTokensBetween(first, second, {
includeComments: true
});
let startIndex = startingNodeOrToken.range[1];
for (const token of tokens) {
if (startIndex !== token.range[0]) {
return true;
}
startIndex = token.range[1];
}
return startIndex !== endingNodeOrToken.range[0];
}
});
cache.set(original, sourceCode);
return sourceCode;
}
function getCwd(context) {
var _a, _b, _c;
return (_c = (_b = context.cwd) != null ? _b : (_a = context.getCwd) == null ? void 0 : _a.call(context)) != null ? _c : (
// getCwd is added in v6.6.0
process.cwd()
);
}
function getFilename(context) {
var _a;
return (_a = context.filename) != null ? _a : context.getFilename();
}
function getPhysicalFilename(context) {
var _a, _b;
const physicalFilename = (_b = context.physicalFilename) != null ? _b : (_a = context.getPhysicalFilename) == null ? void 0 : _a.call(context);
if (physicalFilename != null) {
return physicalFilename;
}
const filename = getFilename(context);
let target = filename;
while (/^\d+_/u.test(path.basename(target)) && !fs.existsSync(target)) {
const next = path.dirname(target);
if (next === target || !path.extname(next)) {
break;
}
target = next;
}
return target;
}
exports.getCwd = getCwd;
exports.getFilename = getFilename;
exports.getPhysicalFilename = getPhysicalFilename;
exports.getSourceCode = getSourceCode;

View file

@ -1,28 +0,0 @@
import { Rule, SourceCode } from 'eslint';
/**
* Returns an extended instance of `context.sourceCode` or the result of `context.getSourceCode()`.
* Extended instances can use new APIs such as `getScope(node)` even with old ESLint.
*/
declare function getSourceCode(context: Rule.RuleContext): SourceCode;
/**
* Gets the value of `context.cwd`, but for older ESLint it returns the result of `context.getCwd()`.
* Versions older than v6.6.0 return a value from the result of `process.cwd()`.
*/
declare function getCwd(context: Rule.RuleContext): string;
/**
* Gets the value of `context.filename`, but for older ESLint it returns the result of `context.getFilename()`.
*/
declare function getFilename(context: Rule.RuleContext): string;
/**
* Gets the value of `context.physicalFilename`,
* but for older ESLint it returns the result of `context.getPhysicalFilename()`.
* Versions older than v7.28.0 return a value guessed from the result of `context.getFilename()`,
* but it may be incorrect.
*/
declare function getPhysicalFilename(context: Rule.RuleContext): string;
export { getCwd, getFilename, getPhysicalFilename, getSourceCode };

View file

@ -1,28 +0,0 @@
import { Rule, SourceCode } from 'eslint';
/**
* Returns an extended instance of `context.sourceCode` or the result of `context.getSourceCode()`.
* Extended instances can use new APIs such as `getScope(node)` even with old ESLint.
*/
declare function getSourceCode(context: Rule.RuleContext): SourceCode;
/**
* Gets the value of `context.cwd`, but for older ESLint it returns the result of `context.getCwd()`.
* Versions older than v6.6.0 return a value from the result of `process.cwd()`.
*/
declare function getCwd(context: Rule.RuleContext): string;
/**
* Gets the value of `context.filename`, but for older ESLint it returns the result of `context.getFilename()`.
*/
declare function getFilename(context: Rule.RuleContext): string;
/**
* Gets the value of `context.physicalFilename`,
* but for older ESLint it returns the result of `context.getPhysicalFilename()`.
* Versions older than v7.28.0 return a value guessed from the result of `context.getFilename()`,
* but it may be incorrect.
*/
declare function getPhysicalFilename(context: Rule.RuleContext): string;
export { getCwd, getFilename, getPhysicalFilename, getSourceCode };

View file

@ -1,28 +0,0 @@
import { Rule, SourceCode } from 'eslint';
/**
* Returns an extended instance of `context.sourceCode` or the result of `context.getSourceCode()`.
* Extended instances can use new APIs such as `getScope(node)` even with old ESLint.
*/
declare function getSourceCode(context: Rule.RuleContext): SourceCode;
/**
* Gets the value of `context.cwd`, but for older ESLint it returns the result of `context.getCwd()`.
* Versions older than v6.6.0 return a value from the result of `process.cwd()`.
*/
declare function getCwd(context: Rule.RuleContext): string;
/**
* Gets the value of `context.filename`, but for older ESLint it returns the result of `context.getFilename()`.
*/
declare function getFilename(context: Rule.RuleContext): string;
/**
* Gets the value of `context.physicalFilename`,
* but for older ESLint it returns the result of `context.getPhysicalFilename()`.
* Versions older than v7.28.0 return a value guessed from the result of `context.getFilename()`,
* but it may be incorrect.
*/
declare function getPhysicalFilename(context: Rule.RuleContext): string;
export { getCwd, getFilename, getPhysicalFilename, getSourceCode };

View file

@ -1,121 +0,0 @@
import { basename, dirname, extname } from 'path';
import { existsSync } from 'fs';
function applyPolyfills(object, polyfill) {
return new Proxy(object, {
get(_target, p) {
var _a;
return (_a = object[p]) != null ? _a : polyfill[p];
}
});
}
function getParent(node) {
return node.parent;
}
const cache = /* @__PURE__ */ new WeakMap();
function getSourceCode(context) {
const original = context.sourceCode || context.getSourceCode();
const cached = cache.get(original);
if (cached) {
return cached;
}
const sourceCode = applyPolyfills(original, {
getScope(node) {
const inner = node.type !== "Program";
for (let n = node; n; n = getParent(n)) {
const scope = original.scopeManager.acquire(n, inner);
if (scope) {
if (scope.type === "function-expression-name") {
return scope.childScopes[0];
}
return scope;
}
}
return original.scopeManager.scopes[0];
},
markVariableAsUsed(name, refNode = original.ast) {
const currentScope = sourceCode.getScope(refNode);
if (currentScope === context.getScope()) {
return context.markVariableAsUsed(name);
}
let initialScope = currentScope;
if (currentScope.type === "global" && currentScope.childScopes.length > 0 && currentScope.childScopes[0].block === original.ast) {
initialScope = currentScope.childScopes[0];
}
for (let scope = initialScope; scope; scope = scope.upper) {
const variable = scope.variables.find(
(scopeVar) => scopeVar.name === name
);
if (variable) {
variable.eslintUsed = true;
return true;
}
}
return false;
},
getAncestors(node) {
const result = [];
for (let ancestor = getParent(node); ancestor; ancestor = ancestor.parent) {
result.unshift(ancestor);
}
return result;
},
getDeclaredVariables(node) {
return original.scopeManager.getDeclaredVariables(node);
},
isSpaceBetween(first, second) {
if (first.range[0] <= second.range[1] && second.range[0] <= first.range[1]) {
return false;
}
const [startingNodeOrToken, endingNodeOrToken] = first.range[1] <= second.range[0] ? [first, second] : [second, first];
const tokens = sourceCode.getTokensBetween(first, second, {
includeComments: true
});
let startIndex = startingNodeOrToken.range[1];
for (const token of tokens) {
if (startIndex !== token.range[0]) {
return true;
}
startIndex = token.range[1];
}
return startIndex !== endingNodeOrToken.range[0];
}
});
cache.set(original, sourceCode);
return sourceCode;
}
function getCwd(context) {
var _a, _b, _c;
return (_c = (_b = context.cwd) != null ? _b : (_a = context.getCwd) == null ? void 0 : _a.call(context)) != null ? _c : (
// getCwd is added in v6.6.0
process.cwd()
);
}
function getFilename(context) {
var _a;
return (_a = context.filename) != null ? _a : context.getFilename();
}
function getPhysicalFilename(context) {
var _a, _b;
const physicalFilename = (_b = context.physicalFilename) != null ? _b : (_a = context.getPhysicalFilename) == null ? void 0 : _a.call(context);
if (physicalFilename != null) {
return physicalFilename;
}
const filename = getFilename(context);
let target = filename;
while (/^\d+_/u.test(basename(target)) && !existsSync(target)) {
const next = dirname(target);
if (next === target || !extname(next)) {
break;
}
target = next;
}
return target;
}
export { getCwd, getFilename, getPhysicalFilename, getSourceCode };

View file

@ -1,48 +0,0 @@
'use strict';
const eslint = require('eslint');
const semver = require('semver');
const convertConfig = require('./shared/eslint-compat-utils.503aeaae.cjs');
const convertOption = require('./shared/eslint-compat-utils.808b5669.cjs');
require('module');
function _interopNamespaceCompat(e) {
if (e && typeof e === 'object' && 'default' in e) return e;
const n = Object.create(null);
if (e) {
for (const k in e) {
n[k] = e[k];
}
}
n.default = e;
return n;
}
const eslint__namespace = /*#__PURE__*/_interopNamespaceCompat(eslint);
const semver__namespace = /*#__PURE__*/_interopNamespaceCompat(semver);
let cacheLinter;
function getLinter() {
return cacheLinter != null ? cacheLinter : cacheLinter = getLinterInternal();
function getLinterInternal() {
if (semver__namespace.gte(eslint__namespace.Linter.version, "9.0.0-0")) {
return eslint__namespace.Linter;
}
return getLinterClassFromLegacyLinter();
}
}
function getLinterClassFromLegacyLinter() {
return class LinterFromLegacyLinter extends eslint__namespace.Linter {
static get version() {
return eslint__namespace.Linter.version;
}
verify(code, config, option) {
const { processor, ...otherConfig } = config || {};
const newConfig = convertConfig.convertConfigToRc(otherConfig, this);
const newOption = convertOption.convertOptionToLegacy(processor, option, config || {});
return super.verify(code, newConfig, newOption);
}
};
}
exports.getLinter = getLinter;

View file

@ -1,8 +0,0 @@
import * as eslint from 'eslint';
/**
* Get Linter class
*/
declare function getLinter(): typeof eslint.Linter;
export { getLinter };

View file

@ -1,8 +0,0 @@
import * as eslint from 'eslint';
/**
* Get Linter class
*/
declare function getLinter(): typeof eslint.Linter;
export { getLinter };

View file

@ -1,8 +0,0 @@
import * as eslint from 'eslint';
/**
* Get Linter class
*/
declare function getLinter(): typeof eslint.Linter;
export { getLinter };

View file

@ -1,31 +0,0 @@
import * as eslint from 'eslint';
import * as semver from 'semver';
import { c as convertConfigToRc } from './shared/eslint-compat-utils.1a5060cf.mjs';
import { c as convertOptionToLegacy } from './shared/eslint-compat-utils.cb6790c2.mjs';
import 'module';
let cacheLinter;
function getLinter() {
return cacheLinter != null ? cacheLinter : cacheLinter = getLinterInternal();
function getLinterInternal() {
if (semver.gte(eslint.Linter.version, "9.0.0-0")) {
return eslint.Linter;
}
return getLinterClassFromLegacyLinter();
}
}
function getLinterClassFromLegacyLinter() {
return class LinterFromLegacyLinter extends eslint.Linter {
static get version() {
return eslint.Linter.version;
}
verify(code, config, option) {
const { processor, ...otherConfig } = config || {};
const newConfig = convertConfigToRc(otherConfig, this);
const newOption = convertOptionToLegacy(processor, option, config || {});
return super.verify(code, newConfig, newOption);
}
};
}
export { getLinter };

View file

@ -1,110 +0,0 @@
'use strict';
const eslint = require('eslint');
const semver = require('semver');
const convertConfig = require('./shared/eslint-compat-utils.503aeaae.cjs');
const getUnsupported = require('./shared/eslint-compat-utils.cb53cf36.cjs');
const convertOption = require('./shared/eslint-compat-utils.808b5669.cjs');
require('module');
function _interopNamespaceCompat(e) {
if (e && typeof e === 'object' && 'default' in e) return e;
const n = Object.create(null);
if (e) {
for (const k in e) {
n[k] = e[k];
}
}
n.default = e;
return n;
}
const eslint__namespace = /*#__PURE__*/_interopNamespaceCompat(eslint);
const semver__namespace = /*#__PURE__*/_interopNamespaceCompat(semver);
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let cacheRuleTester;
let cachePrefix = "";
function getRuleTester() {
return cacheRuleTester != null ? cacheRuleTester : cacheRuleTester = getRuleTesterInternal();
function getRuleTesterInternal() {
if (semver__namespace.gte(eslint__namespace.Linter.version, "9.0.0-0")) {
cachePrefix = "rule-to-test/";
return eslint__namespace.RuleTester;
}
const flatRuleTester = getUnsupported.getUnsupported().FlatRuleTester;
if (flatRuleTester) {
cachePrefix = "rule-to-test/";
return patchForV8FlatRuleTester(flatRuleTester);
}
return getRuleTesterClassFromLegacyRuleTester();
}
}
function getRuleIdPrefix() {
getRuleTester();
return cachePrefix;
}
function patchForV8FlatRuleTester(flatRuleTester) {
return class RuleTesterWithPatch extends flatRuleTester {
constructor(options) {
super(patchConfig(options));
}
};
function patchConfig(config) {
return {
files: ["**/*.*"],
...config
};
}
}
function getRuleTesterClassFromLegacyRuleTester() {
return class RuleTesterForV8 extends eslint__namespace.RuleTester {
constructor(options) {
var _a;
const defineRules = [];
const { processor, ...others } = options;
super(
convertConfig.convertConfigToRc(others, {
defineRule(...args) {
defineRules.push(args);
}
})
);
__publicField(this, "defaultProcessor");
for (const args of defineRules) {
(_a = this.linter) == null ? void 0 : _a.defineRule(...args);
}
this.defaultProcessor = processor;
}
run(name, rule, tests) {
super.run(name, rule, {
valid: (tests.valid || []).map(
(test) => typeof test === "string" ? test : convert(test, this.defaultProcessor)
),
invalid: (tests.invalid || []).map(
(test) => convert(test, this.defaultProcessor)
)
});
}
};
function convert(config, defaultProcessor) {
const { processor: configProcessor, ...otherConfig } = config;
const processor = configProcessor || defaultProcessor;
const converted = convertConfig.convertConfigToRc(otherConfig);
if (!processor) {
return converted;
}
return {
...converted,
filename: convertOption.convertOptionToLegacy(processor, config.filename, config)
};
}
}
exports.getRuleIdPrefix = getRuleIdPrefix;
exports.getRuleTester = getRuleTester;

View file

@ -1,12 +0,0 @@
import * as eslint from 'eslint';
/**
* Get RuleTester class
*/
declare function getRuleTester(): typeof eslint.RuleTester;
/**
* Get the prefix of the ruleId used in the rule tester.
*/
declare function getRuleIdPrefix(): string;
export { getRuleIdPrefix, getRuleTester };

View file

@ -1,12 +0,0 @@
import * as eslint from 'eslint';
/**
* Get RuleTester class
*/
declare function getRuleTester(): typeof eslint.RuleTester;
/**
* Get the prefix of the ruleId used in the rule tester.
*/
declare function getRuleIdPrefix(): string;
export { getRuleIdPrefix, getRuleTester };

View file

@ -1,12 +0,0 @@
import * as eslint from 'eslint';
/**
* Get RuleTester class
*/
declare function getRuleTester(): typeof eslint.RuleTester;
/**
* Get the prefix of the ruleId used in the rule tester.
*/
declare function getRuleIdPrefix(): string;
export { getRuleIdPrefix, getRuleTester };

View file

@ -1,92 +0,0 @@
import * as eslint from 'eslint';
import * as semver from 'semver';
import { c as convertConfigToRc } from './shared/eslint-compat-utils.1a5060cf.mjs';
import { g as getUnsupported } from './shared/eslint-compat-utils.3ecba7ac.mjs';
import { c as convertOptionToLegacy } from './shared/eslint-compat-utils.cb6790c2.mjs';
import 'module';
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let cacheRuleTester;
let cachePrefix = "";
function getRuleTester() {
return cacheRuleTester != null ? cacheRuleTester : cacheRuleTester = getRuleTesterInternal();
function getRuleTesterInternal() {
if (semver.gte(eslint.Linter.version, "9.0.0-0")) {
cachePrefix = "rule-to-test/";
return eslint.RuleTester;
}
const flatRuleTester = getUnsupported().FlatRuleTester;
if (flatRuleTester) {
cachePrefix = "rule-to-test/";
return patchForV8FlatRuleTester(flatRuleTester);
}
return getRuleTesterClassFromLegacyRuleTester();
}
}
function getRuleIdPrefix() {
getRuleTester();
return cachePrefix;
}
function patchForV8FlatRuleTester(flatRuleTester) {
return class RuleTesterWithPatch extends flatRuleTester {
constructor(options) {
super(patchConfig(options));
}
};
function patchConfig(config) {
return {
files: ["**/*.*"],
...config
};
}
}
function getRuleTesterClassFromLegacyRuleTester() {
return class RuleTesterForV8 extends eslint.RuleTester {
constructor(options) {
var _a;
const defineRules = [];
const { processor, ...others } = options;
super(
convertConfigToRc(others, {
defineRule(...args) {
defineRules.push(args);
}
})
);
__publicField(this, "defaultProcessor");
for (const args of defineRules) {
(_a = this.linter) == null ? void 0 : _a.defineRule(...args);
}
this.defaultProcessor = processor;
}
run(name, rule, tests) {
super.run(name, rule, {
valid: (tests.valid || []).map(
(test) => typeof test === "string" ? test : convert(test, this.defaultProcessor)
),
invalid: (tests.invalid || []).map(
(test) => convert(test, this.defaultProcessor)
)
});
}
};
function convert(config, defaultProcessor) {
const { processor: configProcessor, ...otherConfig } = config;
const processor = configProcessor || defaultProcessor;
const converted = convertConfigToRc(otherConfig);
if (!processor) {
return converted;
}
return {
...converted,
filename: convertOptionToLegacy(processor, config.filename, config)
};
}
}
export { getRuleIdPrefix, getRuleTester };

View file

@ -1,193 +0,0 @@
import * as eslint from 'eslint';
import * as semver from 'semver';
import { createRequire } from 'module';
function safeRequire(name) {
try {
return createRequire(`${process.cwd()}/__placeholder__.js`)(name);
} catch {
return void 0;
}
}
function safeRequireResolve(name) {
try {
return createRequire(`${process.cwd()}/__placeholder__.js`).resolve(name);
} catch {
return name;
}
}
const builtInGlobals = /* @__PURE__ */ new Map([
[
3,
Object.entries({
Array: false,
Boolean: false,
constructor: false,
Date: false,
decodeURI: false,
decodeURIComponent: false,
encodeURI: false,
encodeURIComponent: false,
Error: false,
escape: false,
eval: false,
EvalError: false,
Function: false,
hasOwnProperty: false,
Infinity: false,
isFinite: false,
isNaN: false,
isPrototypeOf: false,
Math: false,
NaN: false,
Number: false,
Object: false,
parseFloat: false,
parseInt: false,
propertyIsEnumerable: false,
RangeError: false,
ReferenceError: false,
RegExp: false,
String: false,
SyntaxError: false,
toLocaleString: false,
toString: false,
TypeError: false,
undefined: false,
unescape: false,
URIError: false,
valueOf: false
})
],
[
5,
Object.entries({
JSON: false
})
],
[
2015,
Object.entries({
ArrayBuffer: false,
DataView: false,
Float32Array: false,
Float64Array: false,
Int16Array: false,
Int32Array: false,
Int8Array: false,
Intl: false,
Map: false,
Promise: false,
Proxy: false,
Reflect: false,
Set: false,
Symbol: false,
Uint16Array: false,
Uint32Array: false,
Uint8Array: false,
Uint8ClampedArray: false,
WeakMap: false,
WeakSet: false
})
],
[
2017,
Object.entries({
Atomics: false,
SharedArrayBuffer: false
})
],
[
2020,
Object.entries({
BigInt: false,
BigInt64Array: false,
BigUint64Array: false,
globalThis: false
})
],
[
2021,
Object.entries({
AggregateError: false,
FinalizationRegistry: false,
WeakRef: false
})
]
]);
function convertConfigToRc(config, linter) {
var _a, _b;
if (Array.isArray(config)) {
throw new Error("Array config is not supported.");
}
const {
languageOptions: originalLanguageOptions,
plugins,
...newConfig
} = config;
if (originalLanguageOptions) {
const {
parser,
globals,
parserOptions,
ecmaVersion,
sourceType,
...languageOptions
} = originalLanguageOptions;
newConfig.parserOptions = {
...!ecmaVersion || ecmaVersion === "latest" ? { ecmaVersion: getLatestEcmaVersion() } : { ecmaVersion },
...sourceType ? { sourceType } : { sourceType: "module" },
...languageOptions,
...parserOptions,
...newConfig.parserOptions
};
const resolvedEcmaVersion = newConfig.parserOptions.ecmaVersion;
newConfig.globals = {
...Object.fromEntries(
[...builtInGlobals.entries()].flatMap(
([version, editionGlobals]) => resolvedEcmaVersion < version ? [] : editionGlobals
)
),
...newConfig.globals
};
if (globals) {
newConfig.globals = {
...globals,
...newConfig.globals
};
}
if (parser && !newConfig.parser) {
const parserName = getParserName(parser);
newConfig.parser = parserName;
(_a = linter == null ? void 0 : linter.defineParser) == null ? void 0 : _a.call(linter, parserName, parser);
}
}
if (plugins) {
for (const [pluginName, plugin] of Object.entries(plugins)) {
for (const [ruleName, rule] of Object.entries(plugin.rules || {})) {
(_b = linter == null ? void 0 : linter.defineRule) == null ? void 0 : _b.call(linter, `${pluginName}/${ruleName}`, rule);
}
}
}
newConfig.env = {
es6: true,
...newConfig.env
};
return newConfig;
}
function getParserName(parser) {
var _a;
const name = ((_a = parser.meta) == null ? void 0 : _a.name) || parser.name;
if (name === "typescript-eslint/parser") {
return safeRequireResolve("@typescript-eslint/parser");
} else if (name == null && parser === safeRequire("@typescript-eslint/parser"))
return safeRequireResolve("@typescript-eslint/parser");
return safeRequireResolve(name);
}
function getLatestEcmaVersion() {
const eslintVersion = eslint.Linter.version;
return semver.gte(eslintVersion, "8.0.0") ? "latest" : semver.gte(eslintVersion, "7.8.0") ? 2021 : semver.gte(eslintVersion, "6.2.0") ? 2020 : semver.gte(eslintVersion, "5.0.0") ? 2019 : 2018;
}
export { convertConfigToRc as c };

View file

@ -1,9 +0,0 @@
function getUnsupported() {
try {
return require("eslint/use-at-your-own-risk");
} catch {
return {};
}
}
export { getUnsupported as g };

View file

@ -1,210 +0,0 @@
'use strict';
const eslint = require('eslint');
const semver = require('semver');
const module$1 = require('module');
function _interopNamespaceCompat(e) {
if (e && typeof e === 'object' && 'default' in e) return e;
const n = Object.create(null);
if (e) {
for (const k in e) {
n[k] = e[k];
}
}
n.default = e;
return n;
}
const eslint__namespace = /*#__PURE__*/_interopNamespaceCompat(eslint);
const semver__namespace = /*#__PURE__*/_interopNamespaceCompat(semver);
function safeRequire(name) {
try {
return module$1.createRequire(`${process.cwd()}/__placeholder__.js`)(name);
} catch {
return void 0;
}
}
function safeRequireResolve(name) {
try {
return module$1.createRequire(`${process.cwd()}/__placeholder__.js`).resolve(name);
} catch {
return name;
}
}
const builtInGlobals = /* @__PURE__ */ new Map([
[
3,
Object.entries({
Array: false,
Boolean: false,
constructor: false,
Date: false,
decodeURI: false,
decodeURIComponent: false,
encodeURI: false,
encodeURIComponent: false,
Error: false,
escape: false,
eval: false,
EvalError: false,
Function: false,
hasOwnProperty: false,
Infinity: false,
isFinite: false,
isNaN: false,
isPrototypeOf: false,
Math: false,
NaN: false,
Number: false,
Object: false,
parseFloat: false,
parseInt: false,
propertyIsEnumerable: false,
RangeError: false,
ReferenceError: false,
RegExp: false,
String: false,
SyntaxError: false,
toLocaleString: false,
toString: false,
TypeError: false,
undefined: false,
unescape: false,
URIError: false,
valueOf: false
})
],
[
5,
Object.entries({
JSON: false
})
],
[
2015,
Object.entries({
ArrayBuffer: false,
DataView: false,
Float32Array: false,
Float64Array: false,
Int16Array: false,
Int32Array: false,
Int8Array: false,
Intl: false,
Map: false,
Promise: false,
Proxy: false,
Reflect: false,
Set: false,
Symbol: false,
Uint16Array: false,
Uint32Array: false,
Uint8Array: false,
Uint8ClampedArray: false,
WeakMap: false,
WeakSet: false
})
],
[
2017,
Object.entries({
Atomics: false,
SharedArrayBuffer: false
})
],
[
2020,
Object.entries({
BigInt: false,
BigInt64Array: false,
BigUint64Array: false,
globalThis: false
})
],
[
2021,
Object.entries({
AggregateError: false,
FinalizationRegistry: false,
WeakRef: false
})
]
]);
function convertConfigToRc(config, linter) {
var _a, _b;
if (Array.isArray(config)) {
throw new Error("Array config is not supported.");
}
const {
languageOptions: originalLanguageOptions,
plugins,
...newConfig
} = config;
if (originalLanguageOptions) {
const {
parser,
globals,
parserOptions,
ecmaVersion,
sourceType,
...languageOptions
} = originalLanguageOptions;
newConfig.parserOptions = {
...!ecmaVersion || ecmaVersion === "latest" ? { ecmaVersion: getLatestEcmaVersion() } : { ecmaVersion },
...sourceType ? { sourceType } : { sourceType: "module" },
...languageOptions,
...parserOptions,
...newConfig.parserOptions
};
const resolvedEcmaVersion = newConfig.parserOptions.ecmaVersion;
newConfig.globals = {
...Object.fromEntries(
[...builtInGlobals.entries()].flatMap(
([version, editionGlobals]) => resolvedEcmaVersion < version ? [] : editionGlobals
)
),
...newConfig.globals
};
if (globals) {
newConfig.globals = {
...globals,
...newConfig.globals
};
}
if (parser && !newConfig.parser) {
const parserName = getParserName(parser);
newConfig.parser = parserName;
(_a = linter == null ? void 0 : linter.defineParser) == null ? void 0 : _a.call(linter, parserName, parser);
}
}
if (plugins) {
for (const [pluginName, plugin] of Object.entries(plugins)) {
for (const [ruleName, rule] of Object.entries(plugin.rules || {})) {
(_b = linter == null ? void 0 : linter.defineRule) == null ? void 0 : _b.call(linter, `${pluginName}/${ruleName}`, rule);
}
}
}
newConfig.env = {
es6: true,
...newConfig.env
};
return newConfig;
}
function getParserName(parser) {
var _a;
const name = ((_a = parser.meta) == null ? void 0 : _a.name) || parser.name;
if (name === "typescript-eslint/parser") {
return safeRequireResolve("@typescript-eslint/parser");
} else if (name == null && parser === safeRequire("@typescript-eslint/parser"))
return safeRequireResolve("@typescript-eslint/parser");
return safeRequireResolve(name);
}
function getLatestEcmaVersion() {
const eslintVersion = eslint__namespace.Linter.version;
return semver__namespace.gte(eslintVersion, "8.0.0") ? "latest" : semver__namespace.gte(eslintVersion, "7.8.0") ? 2021 : semver__namespace.gte(eslintVersion, "6.2.0") ? 2020 : semver__namespace.gte(eslintVersion, "5.0.0") ? 2019 : 2018;
}
exports.convertConfigToRc = convertConfigToRc;

View file

@ -1,54 +0,0 @@
'use strict';
function convertOptionToLegacy(processor, verifyOption, config) {
var _a;
if (processor == null)
return verifyOption;
if (typeof processor === "string") {
return convertOptionToLegacy(
findProcessor(processor, config),
verifyOption,
config
);
}
const filename = (_a = typeof verifyOption === "string" ? verifyOption : verifyOption == null ? void 0 : verifyOption.filename) != null ? _a : "<input>";
const preprocess = function(code) {
var _a2;
const result = (_a2 = processor.preprocess) == null ? void 0 : _a2.call(processor, code, filename);
return result ? result : [code];
};
const postprocess = function(messages) {
var _a2;
const result = (_a2 = processor.postprocess) == null ? void 0 : _a2.call(processor, messages, filename);
return result ? result : messages[0];
};
if (verifyOption == null) {
return { preprocess, postprocess };
}
if (typeof verifyOption === "string") {
return { filename: verifyOption, preprocess, postprocess };
}
return { ...verifyOption, preprocess, postprocess };
}
function findProcessor(processor, config) {
var _a, _b;
let pluginName, processorName;
const splitted = processor.split("/")[0];
if (splitted.length === 2) {
pluginName = splitted[0];
processorName = splitted[1];
} else if (splitted.length === 3 && splitted[0].startsWith("@")) {
pluginName = `${splitted[0]}/${splitted[1]}`;
processorName = splitted[2];
} else {
throw new Error(`Could not resolve processor: ${processor}`);
}
const plugin = (_a = config.plugins) == null ? void 0 : _a[pluginName];
const resolved = (_b = plugin == null ? void 0 : plugin.processors) == null ? void 0 : _b[processorName];
if (!resolved) {
throw new Error(`Could not resolve processor: ${processor}`);
}
return resolved;
}
exports.convertOptionToLegacy = convertOptionToLegacy;

View file

@ -1,11 +0,0 @@
'use strict';
function getUnsupported() {
try {
return require("eslint/use-at-your-own-risk");
} catch {
return {};
}
}
exports.getUnsupported = getUnsupported;

View file

@ -1,52 +0,0 @@
function convertOptionToLegacy(processor, verifyOption, config) {
var _a;
if (processor == null)
return verifyOption;
if (typeof processor === "string") {
return convertOptionToLegacy(
findProcessor(processor, config),
verifyOption,
config
);
}
const filename = (_a = typeof verifyOption === "string" ? verifyOption : verifyOption == null ? void 0 : verifyOption.filename) != null ? _a : "<input>";
const preprocess = function(code) {
var _a2;
const result = (_a2 = processor.preprocess) == null ? void 0 : _a2.call(processor, code, filename);
return result ? result : [code];
};
const postprocess = function(messages) {
var _a2;
const result = (_a2 = processor.postprocess) == null ? void 0 : _a2.call(processor, messages, filename);
return result ? result : messages[0];
};
if (verifyOption == null) {
return { preprocess, postprocess };
}
if (typeof verifyOption === "string") {
return { filename: verifyOption, preprocess, postprocess };
}
return { ...verifyOption, preprocess, postprocess };
}
function findProcessor(processor, config) {
var _a, _b;
let pluginName, processorName;
const splitted = processor.split("/")[0];
if (splitted.length === 2) {
pluginName = splitted[0];
processorName = splitted[1];
} else if (splitted.length === 3 && splitted[0].startsWith("@")) {
pluginName = `${splitted[0]}/${splitted[1]}`;
processorName = splitted[2];
} else {
throw new Error(`Could not resolve processor: ${processor}`);
}
const plugin = (_a = config.plugins) == null ? void 0 : _a[pluginName];
const resolved = (_b = plugin == null ? void 0 : plugin.processors) == null ? void 0 : _b[processorName];
if (!resolved) {
throw new Error(`Could not resolve processor: ${processor}`);
}
return resolved;
}
export { convertOptionToLegacy as c };

View file

@ -1,97 +0,0 @@
{
"name": "eslint-compat-utils",
"version": "0.5.1",
"description": "Provides an API for ESLint custom rules that is compatible with the latest ESLint even when using older ESLint.",
"engines": {
"node": ">=12"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./eslint": {
"types": "./dist/eslint.d.ts",
"import": "./dist/eslint.mjs",
"require": "./dist/eslint.cjs"
},
"./linter": {
"types": "./dist/linter.d.ts",
"import": "./dist/linter.mjs",
"require": "./dist/linter.cjs"
},
"./rule-tester": {
"types": "./dist/rule-tester.d.ts",
"import": "./dist/rule-tester.mjs",
"require": "./dist/rule-tester.cjs"
},
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"prebuild": "npm run -s clean",
"build": "unbuild",
"clean": "rimraf .nyc_output dist coverage",
"lint": "npm-run-all \"lint:*\"",
"lint:js": "eslint . --ext .js,.mjs,.ts,.json,.yml,.yaml",
"eslint-fix": "eslint . --ext .js,.mjs,.ts,.json,.yml,.yaml --fix",
"test:cover": "nyc --reporter=lcov npm run test",
"test": "npm run mocha -- \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"update:extract-v6-props": "npm run ts -- tools/extract-v6-props.ts",
"ts": "node -r esbuild-register",
"mocha": "npm run ts -- ./node_modules/mocha/bin/mocha.js",
"prerelease": "npm run clean && npm run build",
"release": "changeset publish"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ota-meshi/eslint-compat-utils.git"
},
"keywords": [
"eslint"
],
"author": "Yosuke Ota (https://github.com/ota-meshi)",
"license": "MIT",
"bugs": {
"url": "https://github.com/ota-meshi/eslint-compat-utils/issues"
},
"homepage": "https://github.com/ota-meshi/eslint-compat-utils#readme",
"peerDependencies": {
"eslint": ">=6.0.0"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@ota-meshi/eslint-plugin": "^0.15.0",
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
"@types/eslint": "^8.44.3",
"@types/mocha": "^10.0.0",
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"esbuild-register": "^3.5.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-json-schema-validator": "^5.0.0",
"eslint-plugin-jsonc": "^2.9.0",
"eslint-plugin-n": "^17.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-yml": "^1.9.0",
"mocha": "^10.2.0",
"npm-run-all2": "^6.0.0",
"nyc": "^15.1.0",
"prettier": "^3.0.3",
"unbuild": "^2.0.0"
},
"dependencies": {
"semver": "^7.5.4"
}
}