@morev/eslint-disable-autofix 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,23 +16,21 @@ It's useful when you want a rule to remain active for linting purposes but preve
16
16
  ---
17
17
 
18
18
  > [!NOTE]
19
- > This is a temporary solution until [this RFC](https://github.com/eslint/rfcs/pull/134) is accepted
20
- > and a final implementation is made that closes [this issue](https://github.com/eslint/eslint/issues/18696) -
19
+ > This is a temporary solution until [this issue](https://github.com/eslint/eslint/issues/18696) is resolved -
21
20
  > after that the feature for disabling autofix for rules will be in the ESLint core.
22
21
  >
23
- > I am working on RFC development and final implementation in the core myself,
24
- > but the process will take some time, and the problem is already there.
22
+ > I tried to get [the RFC implemented](https://github.com/eslint/rfcs/pull/134), but was unsuccessful.
23
+ > Now there is another RFC: <https://github.com/eslint/rfcs/pull/143>
25
24
  >
26
- > I'll probably be able to implement this as a polyfill for the final solution,
27
- > once [the RFC](https://github.com/eslint/rfcs/pull/134) discussion reaches
28
- > a consensus on a public API.
25
+ > I'll probably be able to implement this package as a polyfill for the final solution,
26
+ > once RFC discussion reaches a consensus on a public API.
29
27
 
30
28
  ---
31
29
 
32
30
  > [!IMPORTANT]
33
31
  >
34
- > * Only works with ESLint v9 and its flat config format;
35
- > * You have to restart ESLint server after adding/removing `no-autofix/` prefix to take effect.
32
+ > - Only works with ESLint v9 with flat config format or ESLint v10;
33
+ > - You have to restart ESLint server after adding/removing `no-autofix/` prefix to take effect.
36
34
 
37
35
  ---
38
36
 
@@ -48,15 +46,15 @@ due to project-specific or personal preferences.
48
46
 
49
47
  ## Installation
50
48
 
51
- ```bash
49
+ ```sh
52
50
  pnpm add -D @morev/eslint-disable-autofix
53
51
  ```
54
52
 
55
- ```bash
53
+ ```sh
56
54
  yarn add @morev/eslint-disable-autofix -D
57
55
  ```
58
56
 
59
- ```bash
57
+ ```sh
60
58
  npm install -D @morev/eslint-disable-autofix
61
59
  ```
62
60
 
@@ -111,29 +109,7 @@ export default disableAutofix([
111
109
  1. Strips the prefix to keep the original name of the rule;
112
110
  1. Patches rules from ESLint core or third-party plugins directly to disable autofix.
113
111
 
114
- Under the hood, it uses [`eslint-rule-composer`](https://github.com/not-an-aardvark/eslint-rule-composer)
115
- to wrap rules with autofix disabled.
116
-
117
- >[!CAUTION]
112
+ > [!CAUTION]
118
113
  > Direct patching is quite risky and hacky, it relies on non-public ESLint API. \
119
114
  > While it's currently the only way to access certain rule internals,
120
115
  > it may break in future ESLint versions.
121
-
122
- ## Alternatives
123
-
124
- I've been using [eslint-plugin-no-autofix](https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix)
125
- for a long time and haven't had much trouble with it, however recently problems have arisen:
126
-
127
- 1. Some popular plugins (like [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
128
- or [eslint-stylistic](https://github.com/eslint-stylistic/eslint-stylistic))
129
- switch to the ESM-only distribution format and
130
- [eslint-plugin-no-autofix](https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix) doesn't work with it.
131
- The [issue have no response](https://github.com/aladdin-add/eslint-plugin/issues/104),
132
- so I've decided to create my own solution that works in a different way.
133
- 1. I'm getting tired of rules being renamed just to make them work. \
134
- Say I need to disable a rule with autofix turned off for a single file - I write `/* eslint-disable no-autofix/unicorn/no-lonely-if */`. \
135
- Later, the broken autofix in the original rule gets fixed, I re-enable the main rule,
136
- and now the directive no longer applies, which leads to unexpected changes I didn't want.
137
-
138
- Patching the original rules instead of creating new ones might be a bit riskier technically,
139
- but from a developer experience perspective, it's definitely cleaner and more intuitive.
package/dist/index.cjs CHANGED
@@ -34,14 +34,203 @@ __export(index_exports, {
34
34
  disableAutofix: () => disableAutofix
35
35
  });
36
36
  module.exports = __toCommonJS(index_exports);
37
- var import_utils = require("@morev/utils");
37
+ var import_utils2 = require("@morev/utils");
38
38
  var import_use_at_your_own_risk = __toESM(require("eslint/use-at-your-own-risk"), 1);
39
39
 
40
+ // src/rule-composer.js
41
+ var import_utils = require("@morev/utils");
42
+ var getRuleCreateFunction = (rule) => (0, import_utils.isFunction)(rule) ? rule : rule.create;
43
+ var getRuleMeta = (rule) => {
44
+ return (0, import_utils.isObject)(rule) && "meta" in rule && (0, import_utils.isObject)(rule.meta) ? rule.meta : {};
45
+ };
46
+ var getMessageIds = (rule) => {
47
+ const meta = getRuleMeta(rule);
48
+ return "messages" in meta && (0, import_utils.isObject)(rule.meta.messages) ? meta.messages : {};
49
+ };
50
+ var normalizeMultiArgReportCall = (...args) => {
51
+ if (args.length === 1) return args[0];
52
+ if ((0, import_utils.isString)(args[1])) {
53
+ return {
54
+ node: args[0],
55
+ message: args[1],
56
+ data: args[2],
57
+ fix: args[3]
58
+ };
59
+ }
60
+ return {
61
+ node: args[0],
62
+ loc: args[1],
63
+ message: args[2],
64
+ data: args[3],
65
+ fix: args[4]
66
+ };
67
+ };
68
+ var normalizeReportLoc = (descriptor) => {
69
+ if (!descriptor.loc) return descriptor.node.loc;
70
+ return descriptor.loc.start ? descriptor.loc : { start: descriptor.loc, end: null };
71
+ };
72
+ var normalizeMessagePlaceholders = (descriptor, messageIds) => {
73
+ const message = (0, import_utils.isString)(descriptor.messageId) ? messageIds[descriptor.messageId] : descriptor.message;
74
+ if (!descriptor.data) {
75
+ return {
76
+ message,
77
+ data: (0, import_utils.isString)(descriptor.messageId) ? {} : null
78
+ };
79
+ }
80
+ const normalizedData = /* @__PURE__ */ Object.create(null);
81
+ const interpolatedMessage = message.replaceAll(
82
+ /\{\{\s*([^{}]+?)\s*\}\}/g,
83
+ (fullMatch, term) => {
84
+ if (term in descriptor.data) {
85
+ normalizedData[term] = descriptor.data[term];
86
+ return descriptor.data[term];
87
+ }
88
+ return fullMatch;
89
+ }
90
+ );
91
+ return {
92
+ message: interpolatedMessage,
93
+ data: Object.freeze(normalizedData)
94
+ };
95
+ };
96
+ var getReportNormalizer = (rule) => {
97
+ const messageIds = getMessageIds(rule);
98
+ return function normalizeReport(...args) {
99
+ const descriptor = normalizeMultiArgReportCall(...args);
100
+ const interpolatedMessageAndData = normalizeMessagePlaceholders(descriptor, messageIds);
101
+ return {
102
+ node: descriptor.node,
103
+ message: interpolatedMessageAndData.message,
104
+ messageId: (0, import_utils.isString)(descriptor.messageId) ? descriptor.messageId : null,
105
+ data: (0, import_utils.isString)(descriptor.messageId) ? interpolatedMessageAndData.data : null,
106
+ loc: normalizeReportLoc(descriptor),
107
+ fix: descriptor.fix
108
+ };
109
+ };
110
+ };
111
+ var removeMessageIfMessageIdPresent = (reportDescriptor) => {
112
+ const newDescriptor = { ...reportDescriptor };
113
+ if ((0, import_utils.isString)(reportDescriptor.messageId) && (0, import_utils.isString)(reportDescriptor.message)) {
114
+ delete newDescriptor.message;
115
+ }
116
+ return newDescriptor;
117
+ };
118
+ var getContextVariables = (context) => {
119
+ const filename = "getFilename" in context && (0, import_utils.isFunction)(context.getFilename) ? context.getFilename() : context.filename;
120
+ const sourceCode = "getSourceCode" in context && (0, import_utils.isFunction)(context.getSourceCode) ? context.getSourceCode() : context.sourceCode;
121
+ return { filename, sourceCode };
122
+ };
123
+ var rule_composer_default = Object.freeze({
124
+ filterReports(rule, predicate) {
125
+ return Object.freeze({
126
+ create(context) {
127
+ const { filename, sourceCode } = getContextVariables(context);
128
+ const { settings, options } = context;
129
+ return getRuleCreateFunction(rule)(
130
+ Object.freeze(
131
+ Object.create(
132
+ context,
133
+ {
134
+ report: {
135
+ enumerable: true,
136
+ value(...args) {
137
+ const reportDescriptor = getReportNormalizer(rule)(...args);
138
+ if (predicate(reportDescriptor, {
139
+ sourceCode,
140
+ settings,
141
+ options,
142
+ filename
143
+ })) {
144
+ context.report(removeMessageIfMessageIdPresent(reportDescriptor));
145
+ }
146
+ }
147
+ }
148
+ }
149
+ )
150
+ )
151
+ );
152
+ },
153
+ schema: rule.schema,
154
+ meta: getRuleMeta(rule)
155
+ });
156
+ },
157
+ mapReports(rule, iteratee) {
158
+ return Object.freeze({
159
+ create(context) {
160
+ const { filename, sourceCode } = getContextVariables(context);
161
+ const { settings, options } = context;
162
+ return getRuleCreateFunction(rule)(
163
+ Object.freeze(
164
+ Object.create(
165
+ context,
166
+ {
167
+ report: {
168
+ enumerable: true,
169
+ value(...args) {
170
+ context.report(
171
+ removeMessageIfMessageIdPresent(
172
+ iteratee(
173
+ getReportNormalizer(rule)(...args),
174
+ {
175
+ sourceCode,
176
+ settings,
177
+ options,
178
+ filename
179
+ }
180
+ )
181
+ )
182
+ );
183
+ }
184
+ }
185
+ }
186
+ )
187
+ )
188
+ );
189
+ },
190
+ schema: rule.schema,
191
+ meta: getRuleMeta(rule)
192
+ });
193
+ },
194
+ joinReports(rules) {
195
+ return Object.freeze({
196
+ create(context) {
197
+ return rules.map((rule) => getRuleCreateFunction(rule)(context)).reduce(
198
+ (allListeners, ruleListeners) => Object.keys(ruleListeners).reduce(
199
+ (combinedListeners, key) => {
200
+ const currentListener = combinedListeners[key];
201
+ const ruleListener = ruleListeners[key];
202
+ if (currentListener) {
203
+ return {
204
+ ...combinedListeners,
205
+ [key](...args) {
206
+ currentListener(...args);
207
+ ruleListener(...args);
208
+ }
209
+ };
210
+ }
211
+ return { ...combinedListeners, [key]: ruleListener };
212
+ },
213
+ allListeners
214
+ ),
215
+ /* @__PURE__ */ Object.create(null)
216
+ );
217
+ },
218
+ meta: Object.freeze({
219
+ // eslint-disable-next-line unicorn/prefer-reflect-apply
220
+ messages: Object.assign.apply(
221
+ null,
222
+ [/* @__PURE__ */ Object.create(null), ...rules.map((rule) => getMessageIds(rule))]
223
+ ),
224
+ fixable: "code"
225
+ })
226
+ });
227
+ }
228
+ });
229
+
40
230
  // src/utils.ts
41
- var import_eslint_rule_composer = __toESM(require("eslint-rule-composer"), 1);
42
231
  var createNonFixableRule = (rule) => {
43
232
  if (!rule) return null;
44
- return import_eslint_rule_composer.default.mapReports(
233
+ return rule_composer_default.mapReports(
45
234
  Object.create(rule),
46
235
  (problem) => {
47
236
  problem.fix = null;
@@ -57,25 +246,25 @@ var omitMutable = (source, keys) => {
57
246
  var internalDisableAutofix = (options) => {
58
247
  const { configurations, prefix } = options;
59
248
  const allNoAutofixRules = configurations.reduce((acc, configuration) => {
60
- if ((0, import_utils.isEmpty)(configuration.rules)) return acc;
61
- const rulesToDisableAutofix = import_utils.tsObject.fromEntries(
62
- import_utils.tsObject.entries(configuration.rules).filter(([ruleName, ruleValue]) => ruleName.startsWith(prefix))
249
+ if ((0, import_utils2.isEmpty)(configuration.rules)) return acc;
250
+ const rulesToDisableAutofix = import_utils2.tsObject.fromEntries(
251
+ import_utils2.tsObject.entries(configuration.rules).filter(([ruleName, ruleValue]) => ruleName.startsWith(prefix))
63
252
  );
64
- if ((0, import_utils.isEmpty)(rulesToDisableAutofix)) return acc;
65
- const cleanRules = import_utils.tsObject.fromEntries(
66
- import_utils.tsObject.entries(rulesToDisableAutofix).map(([ruleName, ruleValue]) => [
253
+ if ((0, import_utils2.isEmpty)(rulesToDisableAutofix)) return acc;
254
+ const cleanRules = import_utils2.tsObject.fromEntries(
255
+ import_utils2.tsObject.entries(rulesToDisableAutofix).map(([ruleName, ruleValue]) => [
67
256
  ruleName.replace(`${prefix}/`, ""),
68
257
  ruleValue
69
258
  ])
70
259
  );
71
- omitMutable(configuration.rules, import_utils.tsObject.keys(rulesToDisableAutofix));
260
+ omitMutable(configuration.rules, import_utils2.tsObject.keys(rulesToDisableAutofix));
72
261
  Object.assign(configuration.rules, cleanRules);
73
- acc.push(...import_utils.tsObject.keys(cleanRules));
262
+ acc.push(...import_utils2.tsObject.keys(cleanRules));
74
263
  return acc;
75
264
  }, []);
76
- if ((0, import_utils.isEmpty)(allNoAutofixRules)) return configurations;
265
+ if ((0, import_utils2.isEmpty)(allNoAutofixRules)) return configurations;
77
266
  const allPlugins = configurations.reduce((acc, configuration) => {
78
- import_utils.tsObject.entries(configuration.plugins ?? {}).forEach(([pluginMappingName, pluginObject]) => {
267
+ import_utils2.tsObject.entries(configuration.plugins ?? {}).forEach(([pluginMappingName, pluginObject]) => {
79
268
  acc[pluginMappingName] ??= pluginObject;
80
269
  });
81
270
  return acc;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import * as eslint from 'eslint';
2
1
  import { PlainObject } from '@morev/utils';
2
+ import { Linter } from 'eslint';
3
3
 
4
4
  /**
5
5
  * Options of the factory that creates a `disableAutofix` wrapper.
@@ -37,7 +37,7 @@ type CreateDisableAutofixOptions = {
37
37
  *
38
38
  * @returns Wrapper function that will disable autofix for config rules.
39
39
  */
40
- declare const createDisableAutofix: (options?: Partial<CreateDisableAutofixOptions>) => (configurations: PlainObject[]) => eslint.Linter.Config<eslint.Linter.RulesRecord>[];
40
+ declare const createDisableAutofix: (options?: Partial<CreateDisableAutofixOptions>) => (configurations: PlainObject[]) => Linter.Config[];
41
41
  /**
42
42
  * Wrapper function that will disable autofix
43
43
  * for config rules that have `no-autofix/` prefix.
@@ -61,6 +61,6 @@ declare const createDisableAutofix: (options?: Partial<CreateDisableAutofixOptio
61
61
  * are replaced with the same rules without the prefix,
62
62
  * and the original rules are patched so that `autofix` is not performed.
63
63
  */
64
- declare const disableAutofix: (configurations: PlainObject[]) => eslint.Linter.Config<eslint.Linter.RulesRecord>[];
64
+ declare const disableAutofix: (configurations: PlainObject[]) => Linter.Config[];
65
65
 
66
66
  export { createDisableAutofix, disableAutofix };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as eslint from 'eslint';
2
1
  import { PlainObject } from '@morev/utils';
2
+ import { Linter } from 'eslint';
3
3
 
4
4
  /**
5
5
  * Options of the factory that creates a `disableAutofix` wrapper.
@@ -37,7 +37,7 @@ type CreateDisableAutofixOptions = {
37
37
  *
38
38
  * @returns Wrapper function that will disable autofix for config rules.
39
39
  */
40
- declare const createDisableAutofix: (options?: Partial<CreateDisableAutofixOptions>) => (configurations: PlainObject[]) => eslint.Linter.Config<eslint.Linter.RulesRecord>[];
40
+ declare const createDisableAutofix: (options?: Partial<CreateDisableAutofixOptions>) => (configurations: PlainObject[]) => Linter.Config[];
41
41
  /**
42
42
  * Wrapper function that will disable autofix
43
43
  * for config rules that have `no-autofix/` prefix.
@@ -61,6 +61,6 @@ declare const createDisableAutofix: (options?: Partial<CreateDisableAutofixOptio
61
61
  * are replaced with the same rules without the prefix,
62
62
  * and the original rules are patched so that `autofix` is not performed.
63
63
  */
64
- declare const disableAutofix: (configurations: PlainObject[]) => eslint.Linter.Config<eslint.Linter.RulesRecord>[];
64
+ declare const disableAutofix: (configurations: PlainObject[]) => Linter.Config[];
65
65
 
66
66
  export { createDisableAutofix, disableAutofix };
package/dist/index.js CHANGED
@@ -2,11 +2,200 @@
2
2
  import { isEmpty, tsObject } from "@morev/utils";
3
3
  import riskyEslint from "eslint/use-at-your-own-risk";
4
4
 
5
+ // src/rule-composer.js
6
+ import { isFunction, isObject, isString } from "@morev/utils";
7
+ var getRuleCreateFunction = (rule) => isFunction(rule) ? rule : rule.create;
8
+ var getRuleMeta = (rule) => {
9
+ return isObject(rule) && "meta" in rule && isObject(rule.meta) ? rule.meta : {};
10
+ };
11
+ var getMessageIds = (rule) => {
12
+ const meta = getRuleMeta(rule);
13
+ return "messages" in meta && isObject(rule.meta.messages) ? meta.messages : {};
14
+ };
15
+ var normalizeMultiArgReportCall = (...args) => {
16
+ if (args.length === 1) return args[0];
17
+ if (isString(args[1])) {
18
+ return {
19
+ node: args[0],
20
+ message: args[1],
21
+ data: args[2],
22
+ fix: args[3]
23
+ };
24
+ }
25
+ return {
26
+ node: args[0],
27
+ loc: args[1],
28
+ message: args[2],
29
+ data: args[3],
30
+ fix: args[4]
31
+ };
32
+ };
33
+ var normalizeReportLoc = (descriptor) => {
34
+ if (!descriptor.loc) return descriptor.node.loc;
35
+ return descriptor.loc.start ? descriptor.loc : { start: descriptor.loc, end: null };
36
+ };
37
+ var normalizeMessagePlaceholders = (descriptor, messageIds) => {
38
+ const message = isString(descriptor.messageId) ? messageIds[descriptor.messageId] : descriptor.message;
39
+ if (!descriptor.data) {
40
+ return {
41
+ message,
42
+ data: isString(descriptor.messageId) ? {} : null
43
+ };
44
+ }
45
+ const normalizedData = /* @__PURE__ */ Object.create(null);
46
+ const interpolatedMessage = message.replaceAll(
47
+ /\{\{\s*([^{}]+?)\s*\}\}/g,
48
+ (fullMatch, term) => {
49
+ if (term in descriptor.data) {
50
+ normalizedData[term] = descriptor.data[term];
51
+ return descriptor.data[term];
52
+ }
53
+ return fullMatch;
54
+ }
55
+ );
56
+ return {
57
+ message: interpolatedMessage,
58
+ data: Object.freeze(normalizedData)
59
+ };
60
+ };
61
+ var getReportNormalizer = (rule) => {
62
+ const messageIds = getMessageIds(rule);
63
+ return function normalizeReport(...args) {
64
+ const descriptor = normalizeMultiArgReportCall(...args);
65
+ const interpolatedMessageAndData = normalizeMessagePlaceholders(descriptor, messageIds);
66
+ return {
67
+ node: descriptor.node,
68
+ message: interpolatedMessageAndData.message,
69
+ messageId: isString(descriptor.messageId) ? descriptor.messageId : null,
70
+ data: isString(descriptor.messageId) ? interpolatedMessageAndData.data : null,
71
+ loc: normalizeReportLoc(descriptor),
72
+ fix: descriptor.fix
73
+ };
74
+ };
75
+ };
76
+ var removeMessageIfMessageIdPresent = (reportDescriptor) => {
77
+ const newDescriptor = { ...reportDescriptor };
78
+ if (isString(reportDescriptor.messageId) && isString(reportDescriptor.message)) {
79
+ delete newDescriptor.message;
80
+ }
81
+ return newDescriptor;
82
+ };
83
+ var getContextVariables = (context) => {
84
+ const filename = "getFilename" in context && isFunction(context.getFilename) ? context.getFilename() : context.filename;
85
+ const sourceCode = "getSourceCode" in context && isFunction(context.getSourceCode) ? context.getSourceCode() : context.sourceCode;
86
+ return { filename, sourceCode };
87
+ };
88
+ var rule_composer_default = Object.freeze({
89
+ filterReports(rule, predicate) {
90
+ return Object.freeze({
91
+ create(context) {
92
+ const { filename, sourceCode } = getContextVariables(context);
93
+ const { settings, options } = context;
94
+ return getRuleCreateFunction(rule)(
95
+ Object.freeze(
96
+ Object.create(
97
+ context,
98
+ {
99
+ report: {
100
+ enumerable: true,
101
+ value(...args) {
102
+ const reportDescriptor = getReportNormalizer(rule)(...args);
103
+ if (predicate(reportDescriptor, {
104
+ sourceCode,
105
+ settings,
106
+ options,
107
+ filename
108
+ })) {
109
+ context.report(removeMessageIfMessageIdPresent(reportDescriptor));
110
+ }
111
+ }
112
+ }
113
+ }
114
+ )
115
+ )
116
+ );
117
+ },
118
+ schema: rule.schema,
119
+ meta: getRuleMeta(rule)
120
+ });
121
+ },
122
+ mapReports(rule, iteratee) {
123
+ return Object.freeze({
124
+ create(context) {
125
+ const { filename, sourceCode } = getContextVariables(context);
126
+ const { settings, options } = context;
127
+ return getRuleCreateFunction(rule)(
128
+ Object.freeze(
129
+ Object.create(
130
+ context,
131
+ {
132
+ report: {
133
+ enumerable: true,
134
+ value(...args) {
135
+ context.report(
136
+ removeMessageIfMessageIdPresent(
137
+ iteratee(
138
+ getReportNormalizer(rule)(...args),
139
+ {
140
+ sourceCode,
141
+ settings,
142
+ options,
143
+ filename
144
+ }
145
+ )
146
+ )
147
+ );
148
+ }
149
+ }
150
+ }
151
+ )
152
+ )
153
+ );
154
+ },
155
+ schema: rule.schema,
156
+ meta: getRuleMeta(rule)
157
+ });
158
+ },
159
+ joinReports(rules) {
160
+ return Object.freeze({
161
+ create(context) {
162
+ return rules.map((rule) => getRuleCreateFunction(rule)(context)).reduce(
163
+ (allListeners, ruleListeners) => Object.keys(ruleListeners).reduce(
164
+ (combinedListeners, key) => {
165
+ const currentListener = combinedListeners[key];
166
+ const ruleListener = ruleListeners[key];
167
+ if (currentListener) {
168
+ return {
169
+ ...combinedListeners,
170
+ [key](...args) {
171
+ currentListener(...args);
172
+ ruleListener(...args);
173
+ }
174
+ };
175
+ }
176
+ return { ...combinedListeners, [key]: ruleListener };
177
+ },
178
+ allListeners
179
+ ),
180
+ /* @__PURE__ */ Object.create(null)
181
+ );
182
+ },
183
+ meta: Object.freeze({
184
+ // eslint-disable-next-line unicorn/prefer-reflect-apply
185
+ messages: Object.assign.apply(
186
+ null,
187
+ [/* @__PURE__ */ Object.create(null), ...rules.map((rule) => getMessageIds(rule))]
188
+ ),
189
+ fixable: "code"
190
+ })
191
+ });
192
+ }
193
+ });
194
+
5
195
  // src/utils.ts
6
- import ruleComposer from "eslint-rule-composer";
7
196
  var createNonFixableRule = (rule) => {
8
197
  if (!rule) return null;
9
- return ruleComposer.mapReports(
198
+ return rule_composer_default.mapReports(
10
199
  Object.create(rule),
11
200
  (problem) => {
12
201
  problem.fix = null;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Utility to disable autofix for specific ESLint rules",
4
4
  "type": "module",
5
5
  "private": false,
6
- "version": "1.0.2",
6
+ "version": "1.1.0",
7
7
  "engines": {
8
8
  "node": ">=18"
9
9
  },
@@ -46,34 +46,31 @@
46
46
  "module": "./dist/index.js",
47
47
  "types": "./dist/index.d.ts",
48
48
  "peerDependencies": {
49
- "eslint": "^9.0.0"
49
+ "eslint": "^9.0.0 || ^10.0.0"
50
50
  },
51
51
  "dependencies": {
52
- "@morev/utils": "^3.12.2",
53
- "eslint-rule-composer": "^0.3.0"
52
+ "@morev/utils": "^3.13.1"
54
53
  },
55
54
  "devDependencies": {
56
55
  "@morev/commitlint-config": "^0.2.2",
57
- "@morev/eslint-config": "^38.1.0",
58
- "@morev/stylelint-config": "^7.1.0",
56
+ "@morev/eslint-config": "^41.0.0",
59
57
  "@release-it/conventional-changelog": "^8.0.1",
60
58
  "@types/node": "^22.15.18",
61
- "eslint": "9.27.0",
62
- "eslint-plugin-unicorn": "^59.0.1",
63
- "lefthook": "^1.11.13",
64
- "release-it": "^19.0.2",
65
- "stylelint": "^16.19.1",
59
+ "eslint": "9.39.2",
60
+ "eslint-plugin-unicorn": "^63.0.0",
61
+ "lefthook": "^2.1.0",
62
+ "release-it": "^19.2.4",
66
63
  "ts-node": "^10.9.2",
67
- "tsup": "^8.5.0",
68
- "tsx": "^4.19.4",
69
- "typescript": "^5.8.3",
70
- "vitest": "^3.1.3"
64
+ "tsup": "^8.5.1",
65
+ "tsx": "^4.21.0",
66
+ "typescript": "^5.9.3",
67
+ "vitest": "^4.0.18"
71
68
  },
72
69
  "scripts": {
73
70
  "test": "vitest",
74
71
  "test:dev": "vitest --watch",
75
- "lint": "eslint \"**/*.{js,ts,vue,json,json5,jsonc,yml,yaml,md}\"",
76
- "lint:fix": "eslint \"**/*.{js,ts,vue,json,json5,jsonc,yml,yaml,md}\" --fix",
72
+ "lint": "eslint .",
73
+ "lint:fix": "eslint . --fix",
77
74
  "build": "rm -rf dist && tsup",
78
75
  "release": "release-it --disable-metrics"
79
76
  }