@lntvow/eslint-plugin 8.4.3 → 9.3.6

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 ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ const _package = require('./package.json.cjs');
4
+ const newlineBefore = require('./src/rules/newline-before.cjs');
5
+
6
+ const plugin = {
7
+ meta: {
8
+ name: _package.name,
9
+ version: _package.version
10
+ },
11
+ rules: {
12
+ "newline-before": newlineBefore
13
+ }
14
+ };
15
+
16
+ module.exports = plugin;
@@ -0,0 +1,5 @@
1
+ import { ESLint } from 'eslint';
2
+
3
+ declare const plugin: ESLint.Plugin;
4
+
5
+ export { plugin as default };
@@ -0,0 +1,5 @@
1
+ import { ESLint } from 'eslint';
2
+
3
+ declare const plugin: ESLint.Plugin;
4
+
5
+ export { plugin as default };
@@ -0,0 +1,5 @@
1
+ import { ESLint } from 'eslint';
2
+
3
+ declare const plugin: ESLint.Plugin;
4
+
5
+ export { plugin as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ import { name, version } from './package.json.mjs';
2
+ import newlineBefore from './src/rules/newline-before.mjs';
3
+
4
+ const plugin = {
5
+ meta: {
6
+ name,
7
+ version
8
+ },
9
+ rules: {
10
+ "newline-before": newlineBefore
11
+ }
12
+ };
13
+
14
+ export { plugin as default };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ const name = "@lntvow/eslint-plugin";
4
+ const version = "9.3.6";
5
+
6
+ exports.name = name;
7
+ exports.version = version;
@@ -0,0 +1,4 @@
1
+ const name = "@lntvow/eslint-plugin";
2
+ const version = "9.3.6";
3
+
4
+ export { name, version };
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ const index = require('../utils/index.cjs');
4
+
5
+ const newlineBefore = index.createEslintRule({
6
+ meta: {
7
+ type: "layout",
8
+ docs: {
9
+ description: "Enforce newline before specified keywords",
10
+ category: "Stylistic Issues",
11
+ recommended: true,
12
+ url: "https://eslint.org/docs/rules/newline-before"
13
+ },
14
+ messages: {
15
+ newlineBefore: 'Expected newline before "{{ keyword }}"'
16
+ },
17
+ fixable: "whitespace",
18
+ schema: []
19
+ },
20
+ create(context) {
21
+ const { sourceCode } = context;
22
+ function checkNewLineBefore(node) {
23
+ const tokenBefore = sourceCode.getTokenBefore(node);
24
+ if (!tokenBefore)
25
+ return;
26
+ if (tokenBefore.type === "Punctuator" && tokenBefore.value === "{") {
27
+ return;
28
+ }
29
+ if (tokenBefore && tokenBefore.loc.end.line === node.loc.start.line - 1) {
30
+ context.report({
31
+ node,
32
+ message: "Expected at least one empty line before function call.",
33
+ fix(fixer) {
34
+ return fixer.insertTextBefore(node, "\n");
35
+ }
36
+ });
37
+ }
38
+ }
39
+ return {
40
+ CallExpression(node) {
41
+ if (node.callee.type === "Identifier") {
42
+ const calleeName = node.callee.name;
43
+ if (calleeName === "test" || calleeName === "describe") {
44
+ checkNewLineBefore(node);
45
+ }
46
+ }
47
+ }
48
+ };
49
+ }
50
+ });
51
+
52
+ module.exports = newlineBefore;
@@ -0,0 +1,50 @@
1
+ import { createEslintRule } from '../utils/index.mjs';
2
+
3
+ const newlineBefore = createEslintRule({
4
+ meta: {
5
+ type: "layout",
6
+ docs: {
7
+ description: "Enforce newline before specified keywords",
8
+ category: "Stylistic Issues",
9
+ recommended: true,
10
+ url: "https://eslint.org/docs/rules/newline-before"
11
+ },
12
+ messages: {
13
+ newlineBefore: 'Expected newline before "{{ keyword }}"'
14
+ },
15
+ fixable: "whitespace",
16
+ schema: []
17
+ },
18
+ create(context) {
19
+ const { sourceCode } = context;
20
+ function checkNewLineBefore(node) {
21
+ const tokenBefore = sourceCode.getTokenBefore(node);
22
+ if (!tokenBefore)
23
+ return;
24
+ if (tokenBefore.type === "Punctuator" && tokenBefore.value === "{") {
25
+ return;
26
+ }
27
+ if (tokenBefore && tokenBefore.loc.end.line === node.loc.start.line - 1) {
28
+ context.report({
29
+ node,
30
+ message: "Expected at least one empty line before function call.",
31
+ fix(fixer) {
32
+ return fixer.insertTextBefore(node, "\n");
33
+ }
34
+ });
35
+ }
36
+ }
37
+ return {
38
+ CallExpression(node) {
39
+ if (node.callee.type === "Identifier") {
40
+ const calleeName = node.callee.name;
41
+ if (calleeName === "test" || calleeName === "describe") {
42
+ checkNewLineBefore(node);
43
+ }
44
+ }
45
+ }
46
+ };
47
+ }
48
+ });
49
+
50
+ export { newlineBefore as default };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ function createEslintRule(options) {
4
+ return options;
5
+ }
6
+
7
+ exports.createEslintRule = createEslintRule;
@@ -0,0 +1,5 @@
1
+ function createEslintRule(options) {
2
+ return options;
3
+ }
4
+
5
+ export { createEslintRule };
package/package.json CHANGED
@@ -1,16 +1,27 @@
1
1
  {
2
2
  "name": "@lntvow/eslint-plugin",
3
- "version": "8.4.3",
4
- "description": "eslint/plugin文件",
5
- "main": "index.js",
6
- "keywords": [],
3
+ "version": "9.3.6",
4
+ "description": "eslint-plugin",
5
+ "type": "module",
7
6
  "author": "lntvow",
8
7
  "license": "MIT",
8
+ "keywords": [],
9
9
  "files": [
10
- "index.js"
10
+ "dist"
11
11
  ],
12
- "dependencies": {},
13
- "peerDependencies": {
14
- "eslint": ">=8.43.0"
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.mjs",
14
+ "types": "./dist/index.d.ts",
15
+ "dependencies": {
16
+ "eslint": "^9.0.0"
17
+ },
18
+ "devDependencies": {
19
+ "unbuild": "^2.0.0"
20
+ },
21
+ "scripts": {
22
+ "dev": "pnpm unbuild --format esm --watch",
23
+ "build": "unbuild",
24
+ "rimraf": "rimraf ./node_modules/",
25
+ "release": "git add . && bumpp package.json --all --commit --no-tag --push"
15
26
  }
16
27
  }
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- get: require('./rules/get'),
4
- },
5
- }