eslint-plugin-indent-empty-lines 2.0.0 → 2.0.1

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
@@ -1,8 +1,90 @@
1
- const require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_plugin = require('./plugin.cjs');
2
- const require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_configs_index = require('./configs/index.cjs');
3
1
 
2
+ //#region package.json
3
+ var name = "eslint-plugin-indent-empty-lines";
4
+ var version = "2.0.1";
5
+
6
+ //#endregion
7
+ //#region src/rules/indent-empty-lines.ts
8
+ var indent_empty_lines_default = {
9
+ meta: {
10
+ type: "layout",
11
+ docs: {
12
+ description: "Enforce indention on empty lines",
13
+ url: "https://github.com/funmaker/eslint-plugin-indent-empty-lines/blob/master/docs/rules/indent-empty-lines.md"
14
+ },
15
+ fixable: "whitespace",
16
+ schema: [{ oneOf: [{ enum: ["tab"] }, {
17
+ type: "integer",
18
+ minimum: 0
19
+ }] }],
20
+ defaultOptions: [2]
21
+ },
22
+ create(context) {
23
+ const sourceCode = context.sourceCode;
24
+ return { Program: function checkTrailingSpaces(node) {
25
+ const lines = sourceCode.lines, indentRE = /^[ \t]*/, bracketRE = /^[ \t]*[)}\]]/, padOption = context.options[0] === void 0 ? 2 : context.options[0], padding = padOption === "tab" ? " " : " ".repeat(padOption), paddingName = padOption === "tab" ? "tabs" : "spaces", linesPos = [];
26
+ let desiredIndent = "", currentPos = 0;
27
+ for (const line of lines) {
28
+ linesPos.push(currentPos);
29
+ currentPos += line.length + 1;
30
+ }
31
+ for (let i = lines.length - 1; i >= 0; i--) {
32
+ const line = lines[i];
33
+ const match = indentRE.exec(line);
34
+ if (!match) continue;
35
+ const currentIndent = match[0];
36
+ if (line === currentIndent) {
37
+ if (currentIndent !== desiredIndent) {
38
+ const range = [linesPos[i], linesPos[i] + currentIndent.length];
39
+ context.report({
40
+ node,
41
+ loc: {
42
+ start: {
43
+ line: i + 1,
44
+ column: 0
45
+ },
46
+ end: {
47
+ line: i + 1,
48
+ column: currentIndent.length
49
+ }
50
+ },
51
+ message: `Empty line not indented correctly. (expected ${desiredIndent.length} ${paddingName}, found ${currentIndent.length})`,
52
+ fix(fixer) {
53
+ return fixer.replaceTextRange(range, desiredIndent);
54
+ }
55
+ });
56
+ }
57
+ } else if (bracketRE.exec(line)) desiredIndent = currentIndent + padding;
58
+ else desiredIndent = currentIndent;
59
+ }
60
+ } };
61
+ }
62
+ };
63
+
64
+ //#endregion
65
+ //#region src/plugin.ts
66
+ var plugin_default = {
67
+ meta: {
68
+ name,
69
+ version
70
+ },
71
+ rules: { "indent-empty-lines": indent_empty_lines_default }
72
+ };
73
+
74
+ //#endregion
75
+ //#region src/configs/recommended.ts
76
+ var recommended_default = {
77
+ plugins: { "indent-empty-lines": plugin_default },
78
+ rules: { "indent-empty-lines/indent-empty-lines": ["warn", 2] }
79
+ };
80
+
81
+ //#endregion
82
+ //#region src/configs/index.ts
83
+ var configs_default = { recommended: recommended_default };
84
+
85
+ //#endregion
4
86
  //#region src/index.ts
5
- var src_default = Object.assign(require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_plugin.plugin_default, { configs: require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_configs_index.configs_default });
87
+ var src_default = Object.assign(plugin_default, { configs: configs_default });
6
88
 
7
89
  //#endregion
8
90
  module.exports = src_default;
package/dist/package.js CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "eslint-plugin-indent-empty-lines";
3
- var version = "1.0.2";
3
+ var version = "2.0.1";
4
4
 
5
5
  //#endregion
6
6
  export { name, version };
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"eslint-plugin-indent-empty-lines\",\n \"version\": \"1.0.2\",\n \"description\": \"Enforce indention on empty lines\",\n \"author\": \"Fun Maker <funmaker95@gmail.com>\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/funmaker/eslint-plugin-indent-empty-lines#readme\",\n \"type\": \"module\",\n \"main\": \"dist/index.js\",\n \"exports\": {\n \"import\": \"./index.mjs\",\n \"require\": \"./index.js\"\n },\n \"scripts\": {\n \"build\": \"tsdown\",\n \"lint\": \"eslint\",\n \"lint-fix\": \"eslint --fix\",\n \"test\": \"mocha 'tests/**/*.ts'\"\n },\n \"engines\": {\n \"node\": \">=20.0.0\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/funmaker/eslint-plugin-indent-empty-lines.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/funmaker/eslint-plugin-indent-empty-lines/issues\"\n },\n \"devDependencies\": {\n \"@eslint/compat\": \"^1.4.1\",\n \"@types/mocha\": \"^10.0.10\",\n \"@types/node\": \"^25.0.10\",\n \"@typescript-eslint/eslint-plugin\": \"^8.53.1\",\n \"@typescript-eslint/parser\": \"^8.53.1\",\n \"mocha\": \"^11.7.5\",\n \"tsdown\": \"^0.12.9\",\n \"tsx\": \"^4.21.0\",\n \"typescript\": \"^5.9.3\"\n },\n \"peerDependencies\": {\n \"eslint\": \">=9.0.0\"\n },\n \"files\": [\n \"dist/**/*\"\n ],\n \"keywords\": [\n \"eslint\",\n \"eslintplugin\",\n \"eslint-plugin\"\n ]\n}\n"],"mappings":";WACU;cACG"}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"eslint-plugin-indent-empty-lines\",\n \"version\": \"2.0.1\",\n \"description\": \"Enforce indention on empty lines\",\n \"author\": \"Fun Maker <funmaker95@gmail.com>\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/funmaker/eslint-plugin-indent-empty-lines#readme\",\n \"type\": \"module\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"exports\": {\n \"import\": \"./index.mjs\",\n \"require\": \"./index.js\"\n },\n \"scripts\": {\n \"build\": \"tsdown\",\n \"lint\": \"eslint\",\n \"lint-fix\": \"eslint --fix\",\n \"test\": \"mocha 'tests/**/*.ts'\"\n },\n \"engines\": {\n \"node\": \">=20.0.0\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/funmaker/eslint-plugin-indent-empty-lines.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/funmaker/eslint-plugin-indent-empty-lines/issues\"\n },\n \"devDependencies\": {\n \"@eslint/compat\": \"^1.4.1\",\n \"@types/mocha\": \"^10.0.10\",\n \"@types/node\": \"^25.0.10\",\n \"@typescript-eslint/eslint-plugin\": \"^8.53.1\",\n \"@typescript-eslint/parser\": \"^8.53.1\",\n \"mocha\": \"^11.7.5\",\n \"tsdown\": \"^0.12.9\",\n \"tsx\": \"^4.21.0\",\n \"typescript\": \"^5.9.3\"\n },\n \"peerDependencies\": {\n \"eslint\": \">=9.0.0\"\n },\n \"files\": [\n \"dist/**/*\"\n ],\n \"keywords\": [\n \"eslint\",\n \"eslintplugin\",\n \"eslint-plugin\"\n ]\n}\n"],"mappings":";WACU;cACG"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "eslint-plugin-indent-empty-lines",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Enforce indention on empty lines",
5
5
  "author": "Fun Maker <funmaker95@gmail.com>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/funmaker/eslint-plugin-indent-empty-lines#readme",
8
8
  "type": "module",
9
9
  "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
10
11
  "exports": {
11
12
  "import": "./index.mjs",
12
13
  "require": "./index.js"
@@ -1,7 +0,0 @@
1
- const require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_configs_recommended = require('./recommended.cjs');
2
-
3
- //#region src/configs/index.ts
4
- var configs_default = { recommended: require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_configs_recommended.recommended_default };
5
-
6
- //#endregion
7
- exports.configs_default = configs_default;
@@ -1,10 +0,0 @@
1
- const require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_plugin = require('../plugin.cjs');
2
-
3
- //#region src/configs/recommended.ts
4
- var recommended_default = {
5
- plugins: { "indent-empty-lines": require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_plugin.plugin_default },
6
- rules: { "indent-empty-lines/indent-empty-lines": ["warn", 2] }
7
- };
8
-
9
- //#endregion
10
- exports.recommended_default = recommended_default;
package/dist/index.d.cts DELETED
@@ -1,86 +0,0 @@
1
- import * as eslint0 from "eslint";
2
-
3
- //#region src/index.d.ts
4
- declare const _default: {
5
- meta: {
6
- name: string;
7
- version: string;
8
- };
9
- rules: {
10
- "indent-empty-lines": {
11
- meta: {
12
- type: "layout";
13
- docs: {
14
- description: string;
15
- url: string;
16
- };
17
- fixable: "whitespace";
18
- schema: {
19
- oneOf: ({
20
- enum: string[];
21
- type?: undefined;
22
- minimum?: undefined;
23
- } | {
24
- type: "integer";
25
- minimum: number;
26
- enum?: undefined;
27
- })[];
28
- }[];
29
- defaultOptions: number[];
30
- };
31
- create(context: eslint0.Rule.RuleContext): {
32
- Program: (node: eslint0.AST.Program | (eslint0.AST.Program & {
33
- parent: null;
34
- })) => void;
35
- };
36
- };
37
- };
38
- } & {
39
- configs: {
40
- recommended: {
41
- plugins: {
42
- "indent-empty-lines": {
43
- meta: {
44
- name: string;
45
- version: string;
46
- };
47
- rules: {
48
- "indent-empty-lines": {
49
- meta: {
50
- type: "layout";
51
- docs: {
52
- description: string;
53
- url: string;
54
- };
55
- fixable: "whitespace";
56
- schema: {
57
- oneOf: ({
58
- enum: string[];
59
- type?: undefined;
60
- minimum?: undefined;
61
- } | {
62
- type: "integer";
63
- minimum: number;
64
- enum?: undefined;
65
- })[];
66
- }[];
67
- defaultOptions: number[];
68
- };
69
- create(context: eslint0.Rule.RuleContext): {
70
- Program: (node: eslint0.AST.Program | (eslint0.AST.Program & {
71
- parent: null;
72
- })) => void;
73
- };
74
- };
75
- };
76
- };
77
- };
78
- rules: {
79
- "indent-empty-lines/indent-empty-lines": ["warn", number];
80
- };
81
- };
82
- };
83
- };
84
- //#endregion
85
- export { _default as default };
86
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":""}
package/dist/package.cjs DELETED
@@ -1,18 +0,0 @@
1
-
2
- //#region package.json
3
- var name = "eslint-plugin-indent-empty-lines";
4
- var version = "1.0.2";
5
-
6
- //#endregion
7
- Object.defineProperty(exports, 'name', {
8
- enumerable: true,
9
- get: function () {
10
- return name;
11
- }
12
- });
13
- Object.defineProperty(exports, 'version', {
14
- enumerable: true,
15
- get: function () {
16
- return version;
17
- }
18
- });
package/dist/plugin.cjs DELETED
@@ -1,14 +0,0 @@
1
- const require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_package = require('./package.cjs');
2
- const require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_rules_indent_empty_lines = require('./rules/indent-empty-lines.cjs');
3
-
4
- //#region src/plugin.ts
5
- var plugin_default = {
6
- meta: {
7
- name: require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_package.name,
8
- version: require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_package.version
9
- },
10
- rules: { "indent-empty-lines": require__home_funmaker_sync_programming_js_eslint_plugin_indent_empty_lines_src_rules_indent_empty_lines.indent_empty_lines_default }
11
- };
12
-
13
- //#endregion
14
- exports.plugin_default = plugin_default;
@@ -1,60 +0,0 @@
1
-
2
- //#region src/rules/indent-empty-lines.ts
3
- var indent_empty_lines_default = {
4
- meta: {
5
- type: "layout",
6
- docs: {
7
- description: "Enforce indention on empty lines",
8
- url: "https://github.com/funmaker/eslint-plugin-indent-empty-lines/blob/master/docs/rules/indent-empty-lines.md"
9
- },
10
- fixable: "whitespace",
11
- schema: [{ oneOf: [{ enum: ["tab"] }, {
12
- type: "integer",
13
- minimum: 0
14
- }] }],
15
- defaultOptions: [2]
16
- },
17
- create(context) {
18
- const sourceCode = context.sourceCode;
19
- return { Program: function checkTrailingSpaces(node) {
20
- const lines = sourceCode.lines, indentRE = /^[ \t]*/, bracketRE = /^[ \t]*[)}\]]/, padOption = context.options[0] === void 0 ? 2 : context.options[0], padding = padOption === "tab" ? " " : " ".repeat(padOption), paddingName = padOption === "tab" ? "tabs" : "spaces", linesPos = [];
21
- let desiredIndent = "", currentPos = 0;
22
- for (const line of lines) {
23
- linesPos.push(currentPos);
24
- currentPos += line.length + 1;
25
- }
26
- for (let i = lines.length - 1; i >= 0; i--) {
27
- const line = lines[i];
28
- const match = indentRE.exec(line);
29
- if (!match) continue;
30
- const currentIndent = match[0];
31
- if (line === currentIndent) {
32
- if (currentIndent !== desiredIndent) {
33
- const range = [linesPos[i], linesPos[i] + currentIndent.length];
34
- context.report({
35
- node,
36
- loc: {
37
- start: {
38
- line: i + 1,
39
- column: 0
40
- },
41
- end: {
42
- line: i + 1,
43
- column: currentIndent.length
44
- }
45
- },
46
- message: `Empty line not indented correctly. (expected ${desiredIndent.length} ${paddingName}, found ${currentIndent.length})`,
47
- fix(fixer) {
48
- return fixer.replaceTextRange(range, desiredIndent);
49
- }
50
- });
51
- }
52
- } else if (bracketRE.exec(line)) desiredIndent = currentIndent + padding;
53
- else desiredIndent = currentIndent;
54
- }
55
- } };
56
- }
57
- };
58
-
59
- //#endregion
60
- exports.indent_empty_lines_default = indent_empty_lines_default;