eslint-plugin-kirklin 0.1.7 → 0.1.8

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.cjs CHANGED
@@ -25,10 +25,12 @@ const ifNewline = createEslintRule({
25
25
  create: (context) => {
26
26
  return {
27
27
  IfStatement(node) {
28
- if (!node.consequent)
28
+ if (!node.consequent) {
29
29
  return;
30
- if (node.consequent.type === "BlockStatement")
30
+ }
31
+ if (node.consequent.type === "BlockStatement") {
31
32
  return;
33
+ }
32
34
  if (node.test.loc.end.line === node.consequent.loc.start.line) {
33
35
  context.report({
34
36
  node,
@@ -66,8 +68,9 @@ const importDedupe = createEslintRule({
66
68
  create: (context) => {
67
69
  return {
68
70
  ImportDeclaration(node) {
69
- if (node.specifiers.length <= 1)
71
+ if (node.specifiers.length <= 1) {
70
72
  return;
73
+ }
71
74
  const names = /* @__PURE__ */ new Set();
72
75
  node.specifiers.forEach((n) => {
73
76
  const id = n.local.name;
@@ -82,8 +85,9 @@ const importDedupe = createEslintRule({
82
85
  fix(fixer) {
83
86
  const s = n.range[0];
84
87
  let e = n.range[1];
85
- if (context.getSourceCode().text[e] === ",")
88
+ if (context.getSourceCode().text[e] === ",") {
86
89
  e += 1;
90
+ }
87
91
  return fixer.removeRange([s, e]);
88
92
  }
89
93
  });
@@ -115,14 +119,16 @@ const preferInlineTypeImport = createEslintRule({
115
119
  const sourceCode = context.getSourceCode();
116
120
  return {
117
121
  ImportDeclaration: (node) => {
118
- if (node.specifiers.length === 1 && ["ImportNamespaceSpecifier", "ImportDefaultSpecifier"].includes(node.specifiers[0].type))
122
+ if (node.specifiers.length === 1 && ["ImportNamespaceSpecifier", "ImportDefaultSpecifier"].includes(node.specifiers[0].type)) {
119
123
  return;
124
+ }
120
125
  if (node.importKind === "type") {
121
126
  context.report({
122
127
  *fix(fixer) {
123
128
  yield* removeTypeSpecifier(fixer, sourceCode, node);
124
- for (const specifier of node.specifiers)
129
+ for (const specifier of node.specifiers) {
125
130
  yield fixer.insertTextBefore(specifier, "type ");
131
+ }
126
132
  },
127
133
  loc: node.loc,
128
134
  messageId: "preferInlineTypeImport",
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- declare const _default: {
2
- rules: {
3
- "if-newline": any;
4
- "import-dedupe": any;
5
- "prefer-inline-type-import": any;
6
- };
1
+ declare const _default: {
2
+ rules: {
3
+ "if-newline": any;
4
+ "import-dedupe": any;
5
+ "prefer-inline-type-import": any;
6
+ };
7
7
  };
8
8
 
9
9
  export { _default as default };
package/dist/index.mjs CHANGED
@@ -23,10 +23,12 @@ const ifNewline = createEslintRule({
23
23
  create: (context) => {
24
24
  return {
25
25
  IfStatement(node) {
26
- if (!node.consequent)
26
+ if (!node.consequent) {
27
27
  return;
28
- if (node.consequent.type === "BlockStatement")
28
+ }
29
+ if (node.consequent.type === "BlockStatement") {
29
30
  return;
31
+ }
30
32
  if (node.test.loc.end.line === node.consequent.loc.start.line) {
31
33
  context.report({
32
34
  node,
@@ -64,8 +66,9 @@ const importDedupe = createEslintRule({
64
66
  create: (context) => {
65
67
  return {
66
68
  ImportDeclaration(node) {
67
- if (node.specifiers.length <= 1)
69
+ if (node.specifiers.length <= 1) {
68
70
  return;
71
+ }
69
72
  const names = /* @__PURE__ */ new Set();
70
73
  node.specifiers.forEach((n) => {
71
74
  const id = n.local.name;
@@ -80,8 +83,9 @@ const importDedupe = createEslintRule({
80
83
  fix(fixer) {
81
84
  const s = n.range[0];
82
85
  let e = n.range[1];
83
- if (context.getSourceCode().text[e] === ",")
86
+ if (context.getSourceCode().text[e] === ",") {
84
87
  e += 1;
88
+ }
85
89
  return fixer.removeRange([s, e]);
86
90
  }
87
91
  });
@@ -113,14 +117,16 @@ const preferInlineTypeImport = createEslintRule({
113
117
  const sourceCode = context.getSourceCode();
114
118
  return {
115
119
  ImportDeclaration: (node) => {
116
- if (node.specifiers.length === 1 && ["ImportNamespaceSpecifier", "ImportDefaultSpecifier"].includes(node.specifiers[0].type))
120
+ if (node.specifiers.length === 1 && ["ImportNamespaceSpecifier", "ImportDefaultSpecifier"].includes(node.specifiers[0].type)) {
117
121
  return;
122
+ }
118
123
  if (node.importKind === "type") {
119
124
  context.report({
120
125
  *fix(fixer) {
121
126
  yield* removeTypeSpecifier(fixer, sourceCode, node);
122
- for (const specifier of node.specifiers)
127
+ for (const specifier of node.specifiers) {
123
128
  yield fixer.insertTextBefore(specifier, "type ");
129
+ }
124
130
  },
125
131
  loc: node.loc,
126
132
  messageId: "preferInlineTypeImport",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-kirklin",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/kirklin/eslint-config",
6
6
  "main": "./dist/index.cjs",