@so1ve/eslint-plugin 0.69.1 → 0.70.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.cjs CHANGED
@@ -4,9 +4,9 @@ const utils = require('@typescript-eslint/utils');
4
4
 
5
5
  const createEslintRule = utils.ESLintUtils.RuleCreator((ruleName) => ruleName);
6
6
 
7
- const RULE_NAME$3 = "import-dedupe";
7
+ const RULE_NAME$4 = "import-dedupe";
8
8
  const importDedupe = createEslintRule({
9
- name: RULE_NAME$3,
9
+ name: RULE_NAME$4,
10
10
  meta: {
11
11
  type: "problem",
12
12
  docs: {
@@ -54,9 +54,9 @@ const importDedupe = createEslintRule({
54
54
  }
55
55
  });
56
56
 
57
- const RULE_NAME$2 = "no-inline-type-import";
57
+ const RULE_NAME$3 = "no-inline-type-import";
58
58
  const noInlineTypeImport = createEslintRule({
59
- name: RULE_NAME$2,
59
+ name: RULE_NAME$3,
60
60
  meta: {
61
61
  type: "layout",
62
62
  docs: {
@@ -106,9 +106,9 @@ import { ${valueSpecifiersText} } from "${node.source.value}";`
106
106
  }
107
107
  });
108
108
 
109
- const RULE_NAME$1 = "no-useless-template-string";
109
+ const RULE_NAME$2 = "no-useless-template-string";
110
110
  const noUselessTemplateString = createEslintRule({
111
- name: RULE_NAME$1,
111
+ name: RULE_NAME$2,
112
112
  meta: {
113
113
  type: "problem",
114
114
  docs: {
@@ -142,9 +142,9 @@ const noUselessTemplateString = createEslintRule({
142
142
  }
143
143
  });
144
144
 
145
- const RULE_NAME = "pad-after-last-import";
145
+ const RULE_NAME$1 = "pad-after-last-import";
146
146
  const padAfterLastImport = createEslintRule({
147
- name: RULE_NAME,
147
+ name: RULE_NAME$1,
148
148
  meta: {
149
149
  type: "problem",
150
150
  docs: {
@@ -181,11 +181,54 @@ const padAfterLastImport = createEslintRule({
181
181
  }
182
182
  });
183
183
 
184
+ const RULE_NAME = "no-beginning-newline";
185
+ const noBeginningNewline = createEslintRule({
186
+ name: RULE_NAME,
187
+ meta: {
188
+ type: "layout",
189
+ docs: {
190
+ description: "No beginning newline",
191
+ recommended: "error"
192
+ },
193
+ fixable: "whitespace",
194
+ schema: [],
195
+ messages: {
196
+ noBeginningNewline: "No beginning newline"
197
+ }
198
+ },
199
+ defaultOptions: [],
200
+ create: (context) => {
201
+ const text = context.getSourceCode().text;
202
+ return {
203
+ Program: (node) => {
204
+ const newlines = text.match(/([\n]*)/)[1];
205
+ if (newlines.length > 0) {
206
+ context.report({
207
+ node,
208
+ loc: {
209
+ start: {
210
+ line: 0,
211
+ column: 0
212
+ },
213
+ end: node.loc.start
214
+ },
215
+ messageId: "noBeginningNewline",
216
+ *fix(fixer) {
217
+ yield fixer.removeRange([0, node.range[0]]);
218
+ }
219
+ });
220
+ }
221
+ }
222
+ };
223
+ }
224
+ });
225
+
184
226
  const index = {
185
227
  rules: {
186
228
  "import-dedupe": importDedupe,
187
229
  "no-inline-type-import": noInlineTypeImport,
188
230
  "no-useless-template-string": noUselessTemplateString,
231
+ "no-beginning-newline": noBeginningNewline,
189
232
  "pad-after-last-import": padAfterLastImport
190
233
  }
191
234
  };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  "import-dedupe": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"importDedupe", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
6
6
  "no-inline-type-import": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noInlineTypeImport", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
7
7
  "no-useless-template-string": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noUselessTemplateString", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
8
+ "no-beginning-newline": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noBeginningNewline", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
8
9
  "pad-after-last-import": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"padAfterLastImport", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
9
10
  };
10
11
  };
package/dist/index.mjs CHANGED
@@ -2,9 +2,9 @@ import { ESLintUtils } from '@typescript-eslint/utils';
2
2
 
3
3
  const createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
4
4
 
5
- const RULE_NAME$3 = "import-dedupe";
5
+ const RULE_NAME$4 = "import-dedupe";
6
6
  const importDedupe = createEslintRule({
7
- name: RULE_NAME$3,
7
+ name: RULE_NAME$4,
8
8
  meta: {
9
9
  type: "problem",
10
10
  docs: {
@@ -52,9 +52,9 @@ const importDedupe = createEslintRule({
52
52
  }
53
53
  });
54
54
 
55
- const RULE_NAME$2 = "no-inline-type-import";
55
+ const RULE_NAME$3 = "no-inline-type-import";
56
56
  const noInlineTypeImport = createEslintRule({
57
- name: RULE_NAME$2,
57
+ name: RULE_NAME$3,
58
58
  meta: {
59
59
  type: "layout",
60
60
  docs: {
@@ -104,9 +104,9 @@ import { ${valueSpecifiersText} } from "${node.source.value}";`
104
104
  }
105
105
  });
106
106
 
107
- const RULE_NAME$1 = "no-useless-template-string";
107
+ const RULE_NAME$2 = "no-useless-template-string";
108
108
  const noUselessTemplateString = createEslintRule({
109
- name: RULE_NAME$1,
109
+ name: RULE_NAME$2,
110
110
  meta: {
111
111
  type: "problem",
112
112
  docs: {
@@ -140,9 +140,9 @@ const noUselessTemplateString = createEslintRule({
140
140
  }
141
141
  });
142
142
 
143
- const RULE_NAME = "pad-after-last-import";
143
+ const RULE_NAME$1 = "pad-after-last-import";
144
144
  const padAfterLastImport = createEslintRule({
145
- name: RULE_NAME,
145
+ name: RULE_NAME$1,
146
146
  meta: {
147
147
  type: "problem",
148
148
  docs: {
@@ -179,11 +179,54 @@ const padAfterLastImport = createEslintRule({
179
179
  }
180
180
  });
181
181
 
182
+ const RULE_NAME = "no-beginning-newline";
183
+ const noBeginningNewline = createEslintRule({
184
+ name: RULE_NAME,
185
+ meta: {
186
+ type: "layout",
187
+ docs: {
188
+ description: "No beginning newline",
189
+ recommended: "error"
190
+ },
191
+ fixable: "whitespace",
192
+ schema: [],
193
+ messages: {
194
+ noBeginningNewline: "No beginning newline"
195
+ }
196
+ },
197
+ defaultOptions: [],
198
+ create: (context) => {
199
+ const text = context.getSourceCode().text;
200
+ return {
201
+ Program: (node) => {
202
+ const newlines = text.match(/([\n]*)/)[1];
203
+ if (newlines.length > 0) {
204
+ context.report({
205
+ node,
206
+ loc: {
207
+ start: {
208
+ line: 0,
209
+ column: 0
210
+ },
211
+ end: node.loc.start
212
+ },
213
+ messageId: "noBeginningNewline",
214
+ *fix(fixer) {
215
+ yield fixer.removeRange([0, node.range[0]]);
216
+ }
217
+ });
218
+ }
219
+ }
220
+ };
221
+ }
222
+ });
223
+
182
224
  const index = {
183
225
  rules: {
184
226
  "import-dedupe": importDedupe,
185
227
  "no-inline-type-import": noInlineTypeImport,
186
228
  "no-useless-template-string": noUselessTemplateString,
229
+ "no-beginning-newline": noBeginningNewline,
187
230
  "pad-after-last-import": padAfterLastImport
188
231
  }
189
232
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "0.69.1",
3
+ "version": "0.70.0",
4
4
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
5
5
  "contributors": [
6
6
  {
@@ -32,17 +32,14 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@typescript-eslint/utils": "^5.58.0",
35
- "@vue/reactivity": "^3.2.47",
36
- "eslint-define-config": "^1.18.0"
35
+ "@vue/reactivity": "^3.2.47"
37
36
  },
38
37
  "devDependencies": {
39
38
  "@types/node": "^18.15.11",
40
- "@typescript-eslint/types": "^5.58.0",
41
- "unbuild": "^1.2.1",
42
- "vitest": "^0.30.1"
39
+ "@typescript-eslint/types": "^5.58.0"
43
40
  },
44
41
  "scripts": {
45
- "build": "rimraf dist && unbuild",
42
+ "build": "unbuild",
46
43
  "stub": "unbuild --stub",
47
44
  "test": "vitest"
48
45
  }