eslint-plugin-kirklin 3.1.1 → 4.0.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/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Rule, Linter } from 'eslint';
2
2
 
3
- interface RuleModule<T extends readonly unknown[]> extends Rule.RuleModule {
3
+ type RuleModule<T extends readonly unknown[]> = Rule.RuleModule & {
4
4
  defaultOptions: T;
5
- }
5
+ };
6
6
 
7
7
  type Options$2 = [
8
8
  {
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Rule, Linter } from 'eslint';
2
2
 
3
- interface RuleModule<T extends readonly unknown[]> extends Rule.RuleModule {
3
+ type RuleModule<T extends readonly unknown[]> = Rule.RuleModule & {
4
4
  defaultOptions: T;
5
- }
5
+ };
6
6
 
7
7
  type Options$2 = [
8
8
  {
package/dist/index.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import { isCommaToken } from '@typescript-eslint/utils/ast-utils';
2
-
3
- const version = "3.1.1";
1
+ const version = "4.0.0";
4
2
 
5
3
  const hasDocs = [
6
4
  "consistent-chaining",
@@ -39,7 +37,7 @@ function createRule({
39
37
  create: ((context) => {
40
38
  const optionsWithDefault = context.options.map((options, index) => {
41
39
  return {
42
- ...defaultOptions[index] || {},
40
+ ...defaultOptions?.[index] || {},
43
41
  ...options || {}
44
42
  };
45
43
  });
@@ -184,6 +182,9 @@ const consistentChaining = createEslintRule({
184
182
  });
185
183
 
186
184
  const RULE_NAME$7 = "consistent-list-newline";
185
+ function isCommaToken(token) {
186
+ return token.type === "Punctuator" && token.value === ",";
187
+ }
187
188
  const consistentListNewline = createEslintRule({
188
189
  name: RULE_NAME$7,
189
190
  meta: {
@@ -544,7 +545,7 @@ const importDedupe = createEslintRule({
544
545
  fix(fixer) {
545
546
  const s = n.range[0];
546
547
  let e = n.range[1];
547
- if (context.getSourceCode().text[e] === ",") {
548
+ if (context.sourceCode.text[e] === ",") {
548
549
  e += 1;
549
550
  }
550
551
  return fixer.removeRange([s, e]);
@@ -751,7 +752,7 @@ const noTsExportEqual = createEslintRule({
751
752
  },
752
753
  defaultOptions: [],
753
754
  create: (context) => {
754
- const extension = context.getFilename().split(".").pop();
755
+ const extension = context.filename.split(".").pop();
755
756
  if (!extension) {
756
757
  return {};
757
758
  }
@@ -823,7 +824,7 @@ const topLevelFunction = createEslintRule({
823
824
  },
824
825
  messageId: "topLevelFunctionDeclaration",
825
826
  fix(fixer) {
826
- const code = context.getSourceCode().text;
827
+ const code = context.sourceCode.text;
827
828
  const textName = code.slice(id.range[0], id.range[1]);
828
829
  const textArgs = fnExpression.params.length ? code.slice(fnExpression.params[0].range[0], fnExpression.params[fnExpression.params.length - 1].range[1]) : "";
829
830
  const textBody = body.type === "BlockStatement" ? code.slice(body.range[0], body.range[1]) : `{
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-kirklin",
3
3
  "type": "module",
4
- "version": "3.1.1",
4
+ "version": "4.0.0",
5
5
  "description": "Kirk Lin extended ESLint rules",
6
6
  "author": "Kirk Lin (https://github.com/kirklin)",
7
7
  "license": "MIT",