@bemoje/eslint 1.1.0 → 1.1.2

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.
@@ -1,5 +1,21 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
1
2
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
3
 
4
+ /**
5
+ * Helper to create an ESLint rule with a consistent format.
6
+ */
7
+ declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
8
+ description: string;
9
+ recommended?: boolean;
10
+ requiresTypeChecking?: boolean;
11
+ }>>) => ESLintUtils.RuleModule<MessageIds, Options, {
12
+ description: string;
13
+ recommended?: boolean;
14
+ requiresTypeChecking?: boolean;
15
+ }, ESLintUtils.RuleListener> & {
16
+ name: string;
17
+ };
18
+
3
19
  /**
4
20
  * ESLint plugin for Bemoje projects.
5
21
  */
@@ -35,4 +51,15 @@ declare function eslintPluginBemoje(): {
35
51
  };
36
52
  };
37
53
 
38
- export { eslintPluginBemoje };
54
+ /**
55
+ * Enforce no blank lines between block comments and the next declaration.
56
+ */
57
+ declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
58
+ description: string;
59
+ recommended?: boolean;
60
+ requiresTypeChecking?: boolean;
61
+ }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
62
+ name: string;
63
+ };
64
+
65
+ export { createRule, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration };
@@ -1,8 +1,11 @@
1
- import '../chunk-SHUYVCID.js';
2
- import { AST_TOKEN_TYPES } from '@typescript-eslint/utils';
3
- import { createRule } from '../lib/createRule.js';
1
+ import { ESLintUtils, AST_TOKEN_TYPES } from '@typescript-eslint/utils';
4
2
 
5
- const noBlankLineBetweenCommentAndDeclaration = createRule({
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ var createRule = ESLintUtils.RuleCreator((name) => {
6
+ return `https://github.com/bemoje/mono/blob/dev/libs/eslint/README.md#${name}`;
7
+ });
8
+ var noBlankLineBetweenCommentAndDeclaration = createRule({
6
9
  name: "no-blank-line-between-comment-and-declaration",
7
10
  meta: {
8
11
  fixable: "whitespace",
@@ -63,4 +66,32 @@ const noBlankLineBetweenCommentAndDeclaration = createRule({
63
66
  }
64
67
  });
65
68
 
66
- export { noBlankLineBetweenCommentAndDeclaration };
69
+ // src/lib/eslintPluginBemoje.ts
70
+ function eslintPluginBemoje() {
71
+ const rules = {
72
+ "no-blank-line-between-comment-and-declaration": noBlankLineBetweenCommentAndDeclaration
73
+ };
74
+ const plugins = {
75
+ get "eslint-plugin-bemoje"() {
76
+ return eslintPluginBemoje();
77
+ }
78
+ };
79
+ return {
80
+ configs: {
81
+ get recommended() {
82
+ return {
83
+ plugins,
84
+ rules
85
+ };
86
+ }
87
+ },
88
+ meta: {
89
+ name: "eslint-plugin-bemoje",
90
+ version: "1.0.1"
91
+ },
92
+ rules
93
+ };
94
+ }
95
+ __name(eslintPluginBemoje, "eslintPluginBemoje");
96
+
97
+ export { createRule, eslintPluginBemoje, noBlankLineBetweenCommentAndDeclaration };
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@bemoje/eslint",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Custom ESLint plugin and rule utilities for consistent code style in TypeScript projects.",
5
+ "type": "module",
6
+ "sideEffects": false,
5
7
  "keywords": [
6
8
  "eslint",
7
9
  "eslint-plugin",
@@ -11,86 +13,33 @@
11
13
  "utilities",
12
14
  "typescript"
13
15
  ],
14
- "dependencies": {
15
- "@typescript-eslint/utils": "^8.56.1"
16
- },
17
- "type": "module",
18
- "sideEffects": false,
19
- "publishConfig": {
20
- "access": "public"
21
- },
22
- "main": "./lib/index.cjs",
23
- "module": "./lib/index.js",
24
- "types": "./lib/index.d.ts",
25
16
  "exports": {
26
17
  ".": {
27
- "import": {
28
- "types": "./lib/index.d.ts",
29
- "default": "./lib/index.js"
30
- },
31
- "require": {
32
- "types": "./lib/index.d.cts",
33
- "default": "./lib/index.cjs"
34
- }
18
+ "types": "./index.d.ts",
19
+ "import": "./index.mjs",
20
+ "default": "./index.mjs"
35
21
  },
36
- "./lib/createRule": {
37
- "import": {
38
- "types": "./lib/lib/createRule.d.ts",
39
- "default": "./lib/lib/createRule.js"
40
- },
41
- "require": {
42
- "types": "./lib/lib/createRule.d.cts",
43
- "default": "./lib/lib/createRule.cjs"
44
- }
45
- },
46
- "./lib/eslintPluginBemoje": {
47
- "import": {
48
- "types": "./lib/lib/eslintPluginBemoje.d.ts",
49
- "default": "./lib/lib/eslintPluginBemoje.js"
50
- },
51
- "require": {
52
- "types": "./lib/lib/eslintPluginBemoje.d.cts",
53
- "default": "./lib/lib/eslintPluginBemoje.cjs"
54
- }
55
- },
56
- "./rules/noBlankLineBetweenCommentAndDeclaration": {
57
- "import": {
58
- "types": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.ts",
59
- "default": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.js"
60
- },
61
- "require": {
62
- "types": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.cts",
63
- "default": "./lib/rules/noBlankLineBetweenCommentAndDeclaration.cjs"
64
- }
22
+ "./*": {
23
+ "types": "./index.d.ts",
24
+ "import": "./index.mjs",
25
+ "default": "./index.mjs"
65
26
  }
66
27
  },
67
- "files": [
68
- "./lib/index.js",
69
- "./lib/index.d.ts",
70
- "./lib/index.cjs",
71
- "./lib/index.d.cts",
72
- "./lib/lib/createRule.js",
73
- "./lib/lib/createRule.d.ts",
74
- "./lib/lib/createRule.cjs",
75
- "./lib/lib/createRule.d.cts",
76
- "./lib/lib/eslintPluginBemoje.js",
77
- "./lib/lib/eslintPluginBemoje.d.ts",
78
- "./lib/lib/eslintPluginBemoje.cjs",
79
- "./lib/lib/eslintPluginBemoje.d.cts",
80
- "./lib/rules/noBlankLineBetweenCommentAndDeclaration.js",
81
- "./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.ts",
82
- "./lib/rules/noBlankLineBetweenCommentAndDeclaration.cjs",
83
- "./lib/rules/noBlankLineBetweenCommentAndDeclaration.d.cts"
84
- ],
85
- "repository": {
86
- "type": "git",
87
- "url": "git+https://github.com/bemoje/mono.git",
88
- "directory": "libs/eslint"
28
+ "dependencies": {
29
+ "@typescript-eslint/utils": "^8.56.1"
89
30
  },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "license": "MIT",
90
35
  "author": {
91
36
  "name": "Benjamin Møller Jensen",
92
37
  "email": "bemoje@bemoje.net",
93
38
  "url": "https://github.com/bemoje/"
94
39
  },
95
- "license": "MIT"
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/bemoje/mono.git",
43
+ "directory": "libs/eslint"
44
+ }
96
45
  }
package/lib/index.cjs DELETED
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- var createRule = require('./lib/createRule');
4
- var eslintPluginBemoje = require('./lib/eslintPluginBemoje');
5
- var noBlankLineBetweenCommentAndDeclaration = require('./rules/noBlankLineBetweenCommentAndDeclaration');
6
-
7
-
8
-
9
- Object.keys(createRule).forEach(function (k) {
10
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
11
- enumerable: true,
12
- get: function () { return createRule[k]; }
13
- });
14
- });
15
- Object.keys(eslintPluginBemoje).forEach(function (k) {
16
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
17
- enumerable: true,
18
- get: function () { return eslintPluginBemoje[k]; }
19
- });
20
- });
21
- Object.keys(noBlankLineBetweenCommentAndDeclaration).forEach(function (k) {
22
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
23
- enumerable: true,
24
- get: function () { return noBlankLineBetweenCommentAndDeclaration[k]; }
25
- });
26
- });
package/lib/index.d.cts DELETED
@@ -1,5 +0,0 @@
1
- export { createRule } from './lib/createRule.cjs';
2
- export { eslintPluginBemoje } from './lib/eslintPluginBemoje.cjs';
3
- export { noBlankLineBetweenCommentAndDeclaration } from './rules/noBlankLineBetweenCommentAndDeclaration.cjs';
4
- import '@typescript-eslint/utils';
5
- import '@typescript-eslint/utils/ts-eslint';
package/lib/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { createRule } from './lib/createRule.js';
2
- export { eslintPluginBemoje } from './lib/eslintPluginBemoje.js';
3
- export { noBlankLineBetweenCommentAndDeclaration } from './rules/noBlankLineBetweenCommentAndDeclaration.js';
4
- import '@typescript-eslint/utils';
5
- import '@typescript-eslint/utils/ts-eslint';
package/lib/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from './lib/createRule';
2
- export * from './lib/eslintPluginBemoje';
3
- export * from './rules/noBlankLineBetweenCommentAndDeclaration';
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('@typescript-eslint/utils');
4
-
5
- const createRule = utils.ESLintUtils.RuleCreator((name) => {
6
- return `https://github.com/bemoje/mono/blob/dev/libs/eslint/README.md#${name}`;
7
- });
8
-
9
- exports.createRule = createRule;
@@ -1,18 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
-
3
- /**
4
- * Helper to create an ESLint rule with a consistent format.
5
- */
6
- declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
7
- description: string;
8
- recommended?: boolean;
9
- requiresTypeChecking?: boolean;
10
- }>>) => ESLintUtils.RuleModule<MessageIds, Options, {
11
- description: string;
12
- recommended?: boolean;
13
- requiresTypeChecking?: boolean;
14
- }, ESLintUtils.RuleListener> & {
15
- name: string;
16
- };
17
-
18
- export { createRule };
@@ -1,18 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
-
3
- /**
4
- * Helper to create an ESLint rule with a consistent format.
5
- */
6
- declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
7
- description: string;
8
- recommended?: boolean;
9
- requiresTypeChecking?: boolean;
10
- }>>) => ESLintUtils.RuleModule<MessageIds, Options, {
11
- description: string;
12
- recommended?: boolean;
13
- requiresTypeChecking?: boolean;
14
- }, ESLintUtils.RuleListener> & {
15
- name: string;
16
- };
17
-
18
- export { createRule };
@@ -1,8 +0,0 @@
1
- import '../chunk-SHUYVCID.js';
2
- import { ESLintUtils } from '@typescript-eslint/utils';
3
-
4
- const createRule = ESLintUtils.RuleCreator((name) => {
5
- return `https://github.com/bemoje/mono/blob/dev/libs/eslint/README.md#${name}`;
6
- });
7
-
8
- export { createRule };
@@ -1,34 +0,0 @@
1
- 'use strict';
2
-
3
- var noBlankLineBetweenCommentAndDeclaration = require('../rules/noBlankLineBetweenCommentAndDeclaration');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- function eslintPluginBemoje() {
8
- const rules = {
9
- "no-blank-line-between-comment-and-declaration": noBlankLineBetweenCommentAndDeclaration.noBlankLineBetweenCommentAndDeclaration
10
- };
11
- const plugins = {
12
- get "eslint-plugin-bemoje"() {
13
- return eslintPluginBemoje();
14
- }
15
- };
16
- return {
17
- configs: {
18
- get recommended() {
19
- return {
20
- plugins,
21
- rules
22
- };
23
- }
24
- },
25
- meta: {
26
- name: "eslint-plugin-bemoje",
27
- version: "1.0.1"
28
- },
29
- rules
30
- };
31
- }
32
- __name(eslintPluginBemoje, "eslintPluginBemoje");
33
-
34
- exports.eslintPluginBemoje = eslintPluginBemoje;
@@ -1,38 +0,0 @@
1
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
-
3
- /**
4
- * ESLint plugin for Bemoje projects.
5
- */
6
- declare function eslintPluginBemoje(): {
7
- configs: {
8
- readonly recommended: {
9
- plugins: {
10
- readonly 'eslint-plugin-bemoje': any;
11
- };
12
- rules: {
13
- 'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
14
- description: string;
15
- recommended?: boolean;
16
- requiresTypeChecking?: boolean;
17
- }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
18
- name: string;
19
- };
20
- };
21
- };
22
- };
23
- meta: {
24
- name: string;
25
- version: string;
26
- };
27
- rules: {
28
- 'no-blank-line-between-comment-and-declaration': _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
29
- description: string;
30
- recommended?: boolean;
31
- requiresTypeChecking?: boolean;
32
- }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
33
- name: string;
34
- };
35
- };
36
- };
37
-
38
- export { eslintPluginBemoje };
@@ -1,31 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
- import { noBlankLineBetweenCommentAndDeclaration } from '../rules/noBlankLineBetweenCommentAndDeclaration';
3
-
4
- function eslintPluginBemoje() {
5
- const rules = {
6
- "no-blank-line-between-comment-and-declaration": noBlankLineBetweenCommentAndDeclaration
7
- };
8
- const plugins = {
9
- get "eslint-plugin-bemoje"() {
10
- return eslintPluginBemoje();
11
- }
12
- };
13
- return {
14
- configs: {
15
- get recommended() {
16
- return {
17
- plugins,
18
- rules
19
- };
20
- }
21
- },
22
- meta: {
23
- name: "eslint-plugin-bemoje",
24
- version: "1.0.1"
25
- },
26
- rules
27
- };
28
- }
29
- __name(eslintPluginBemoje, "eslintPluginBemoje");
30
-
31
- export { eslintPluginBemoje };
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('@typescript-eslint/utils');
4
- var createRule_js = require('../lib/createRule.js');
5
-
6
- const noBlankLineBetweenCommentAndDeclaration = createRule_js.createRule({
7
- name: "no-blank-line-between-comment-and-declaration",
8
- meta: {
9
- fixable: "whitespace",
10
- docs: {
11
- description: "Consistant whitespace ",
12
- recommended: true
13
- },
14
- messages: {
15
- "no-blank-line-between-comment-and-declaration": "Block comments for a declaration must not leave blank lines between them."
16
- },
17
- type: "problem",
18
- schema: []
19
- },
20
- defaultOptions: [
21
- "error"
22
- ],
23
- create(context) {
24
- return {
25
- Program(program) {
26
- program.comments?.forEach((comment) => {
27
- if (comment.type !== utils.AST_TOKEN_TYPES.Block) {
28
- return;
29
- }
30
- if (Math.abs(comment.loc.start.line - comment.loc.end.line) < 2) {
31
- return;
32
- }
33
- const nextToken = context.sourceCode.getTokenAfter(comment);
34
- if (!nextToken) {
35
- return;
36
- }
37
- const actualNextTokenStartLine = nextToken.loc.start.line;
38
- const expectedTokenStartLine = comment.loc.end.line + 1;
39
- if (!(actualNextTokenStartLine > expectedTokenStartLine)) {
40
- return;
41
- }
42
- const lineBeforeNextToken = context.sourceCode.lines[nextToken.loc.start.line - 1 - 1];
43
- const hasLineCommentBetween = lineBeforeNextToken.trim().startsWith("//");
44
- if (hasLineCommentBetween) {
45
- return;
46
- }
47
- return context.report({
48
- node: program,
49
- messageId: "no-blank-line-between-comment-and-declaration",
50
- fix(fixer) {
51
- const start = comment.range[0];
52
- const end = nextToken.range[1];
53
- const rangeCode = context.sourceCode.text.slice(start, end);
54
- const rangeCodeFixed = rangeCode.replaceAll(/\*\/\n\n+/gi, "*/\n");
55
- return fixer.replaceTextRange([
56
- start,
57
- end
58
- ], rangeCodeFixed);
59
- }
60
- });
61
- });
62
- }
63
- };
64
- }
65
- });
66
-
67
- exports.noBlankLineBetweenCommentAndDeclaration = noBlankLineBetweenCommentAndDeclaration;
@@ -1,14 +0,0 @@
1
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
-
3
- /**
4
- * Enforce no blank lines between block comments and the next declaration.
5
- */
6
- declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
7
- description: string;
8
- recommended?: boolean;
9
- requiresTypeChecking?: boolean;
10
- }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
11
- name: string;
12
- };
13
-
14
- export { noBlankLineBetweenCommentAndDeclaration };
@@ -1,14 +0,0 @@
1
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
-
3
- /**
4
- * Enforce no blank lines between block comments and the next declaration.
5
- */
6
- declare const noBlankLineBetweenCommentAndDeclaration: _typescript_eslint_utils_ts_eslint.RuleModule<"no-blank-line-between-comment-and-declaration", [string], {
7
- description: string;
8
- recommended?: boolean;
9
- requiresTypeChecking?: boolean;
10
- }, _typescript_eslint_utils_ts_eslint.RuleListener> & {
11
- name: string;
12
- };
13
-
14
- export { noBlankLineBetweenCommentAndDeclaration };