@tony.ganchev/eslint-plugin-header 3.2.4 → 3.2.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/CONTRIBUTING.md +8 -8
- package/LICENSE.md +2 -1
- package/index.d.ts +5 -5
- package/index.js +6 -6
- package/lib/comment-parser.js +9 -8
- package/lib/rules/eslint-utils.js +9 -9
- package/lib/rules/header.docs.js +5 -6
- package/lib/rules/header.js +543 -572
- package/lib/rules/header.schema.js +7 -6
- package/package.json +26 -26
- package/types/index.d.ts +1 -1
- package/types/lib/comment-parser.d.ts +1 -1
- package/types/lib/comment-parser.d.ts.map +1 -1
- package/types/lib/rules/header.d.ts +88 -53
- package/types/lib/rules/header.d.ts.map +1 -1
- package/types/lib/rules/header.schema.d.ts +1 -1
- package/types/lib/rules/header.schema.d.ts.map +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -45,20 +45,20 @@ There are two product lines as of today:
|
|
|
45
45
|
After cloning the repository you can try to do a full CI/CD run:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
$
|
|
48
|
+
$ pnpm install
|
|
49
49
|
...
|
|
50
|
-
$
|
|
50
|
+
$ pnpm run test
|
|
51
51
|
...
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
It will run a number of other npm scripts that together verify the code:
|
|
55
55
|
|
|
56
|
-
| script
|
|
57
|
-
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
56
|
+
| script | Description |
|
|
57
|
+
|--------------|---------------------------------------------------------------|
|
|
58
|
+
| `pnpm lint` | Lints the source and docs. |
|
|
59
|
+
| `pnpm unit` | Runs all mocha unit tests. |
|
|
60
|
+
| `pnpm build` | Generates TypeScript bindings. Prerequisite for E2E tests. |
|
|
61
|
+
| `pnpm e2e` | Runs E2E smoke tests for all supported versions of ESLint. |
|
|
62
62
|
|
|
63
63
|
## Development
|
|
64
64
|
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2015-present Stuart Knightley
|
|
3
|
+
Copyright (c) 2015-present Stuart Knightley and contributors
|
|
4
|
+
Copyright (c) 2024-present Tony Ganchev
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
7
|
this software and associated documentation files (the “Software”), to deal in
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2026
|
|
5
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* @file Entry point `index.js` type definitions to support TypeScript-based
|
|
3
|
+
* ESLint configuration. Ensures only the public interfaces are exposed.
|
|
4
|
+
* @copyright Copyright (c) 2026 Tony Ganchev
|
|
5
|
+
* @license MIT
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the “Software”), to deal
|
|
8
8
|
* in the Software without restriction, including without limitation the rights
|
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c)
|
|
5
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* @file Entry point for the plugin.
|
|
3
|
+
* @copyright Copyright (c) 2015-present Stuart Knightley and contributors
|
|
4
|
+
* @copyright Copyright (c) 2025-2026 Tony Ganchev
|
|
5
|
+
* @license MIT
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the “Software”), to deal
|
|
8
8
|
* in the Software without restriction, including without limitation the rights
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
const { header } = require("./lib/rules/header");
|
|
28
28
|
|
|
29
|
-
/** @type {import(
|
|
29
|
+
/** @type {import("eslint").ESLint.Plugin} */
|
|
30
30
|
const pluginDefinition = {
|
|
31
31
|
rules: {
|
|
32
32
|
header
|
package/lib/comment-parser.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c)
|
|
5
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* @file Parsing utility for JavaScript comments to get text content and type.
|
|
3
|
+
* @copyright Copyright (c) 2015-present Stuart Knightley and contributors
|
|
4
|
+
* @copyright Copyright (c) 2025-2026 Tony Ganchev
|
|
5
|
+
* @license MIT
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the “Software”), to deal
|
|
8
8
|
* in the Software without restriction, including without limitation the rights
|
|
@@ -32,9 +32,10 @@ const assert = require("node:assert");
|
|
|
32
32
|
*
|
|
33
33
|
* This is a really simple and dumb parser, that looks just for a
|
|
34
34
|
* single kind of comment. It won't detect multiple block comments.
|
|
35
|
-
* @param {string} commentText
|
|
36
|
-
* @returns {[
|
|
37
|
-
*
|
|
35
|
+
* @param {string} commentText Content to parse.
|
|
36
|
+
* @returns {[import("./rules/header").CommentType, string[]]} Comment type and
|
|
37
|
+
* comment content broken into lines.
|
|
38
|
+
* @throws {Error} If `commentText` starts with an unrecognized comment token.
|
|
38
39
|
*/
|
|
39
40
|
module.exports = function commentParser(commentText) {
|
|
40
41
|
assert.strictEqual(typeof commentText, "string");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2025-
|
|
5
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* @file Utilities to bridge incompatible versions of ESLint APIs. Currently it
|
|
3
|
+
* wraps methods removed in ESLint 10 but required for ESLint 7.
|
|
4
|
+
* @copyright Copyright (c) 2025-2026 Tony Ganchev
|
|
5
|
+
* @license MIT
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the “Software”), to deal
|
|
8
8
|
* in the Software without restriction, including without limitation the rights
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"use strict";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @typedef {import(
|
|
29
|
-
* @typedef {import(
|
|
28
|
+
* @typedef {import("eslint").Rule.RuleContext} RuleContext
|
|
29
|
+
* @typedef {import("eslint").SourceCode} SourceCode
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
module.exports = {
|
|
@@ -34,9 +34,9 @@ module.exports = {
|
|
|
34
34
|
* Provides compatibility wrapper for ESLint 7 through 10 for getting the
|
|
35
35
|
* full source code object from the execution context.
|
|
36
36
|
* @param {RuleContext} context ESLint execution context.
|
|
37
|
-
* @returns {SourceCode}
|
|
37
|
+
* @returns {SourceCode} The source-code object.
|
|
38
38
|
*/
|
|
39
|
-
contextSourceCode: function(context) {
|
|
39
|
+
contextSourceCode: function (context) {
|
|
40
40
|
return context.sourceCode
|
|
41
41
|
|| /** @type {RuleContext & { getSourceCode: () => SourceCode }} */(context).getSourceCode();
|
|
42
42
|
}
|
package/lib/rules/header.docs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2025-
|
|
5
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* @file Constants to use when constructing the metadata of the `header` rule.
|
|
3
|
+
* It aims to reduce the size of the already large main header.js.
|
|
4
|
+
* @copyright Copyright (c) 2025-2026 Tony Ganchev
|
|
5
|
+
* @license MIT
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the “Software”), to deal
|
|
8
8
|
* in the Software without restriction, including without limitation the rights
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
"use strict";
|
|
27
26
|
|
|
28
27
|
exports.description = "The rule validates that the source file starts with a specific header comment pattern.";
|