@tony.ganchev/eslint-plugin-header 3.3.2 → 3.3.4

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/README.md CHANGED
@@ -2,18 +2,19 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@tony.ganchev/eslint-plugin-header.svg)](https://www.npmjs.com/package/@tony.ganchev/eslint-plugin-header)
4
4
  [![Downloads/month](https://img.shields.io/npm/dm/@tony.ganchev/eslint-plugin-header.svg)](http://www.npmtrends.com/@tony.ganchev/eslint-plugin-header)
5
- [![Build Status](https://github.com/tonyganchev/eslint-plugin-header/workflows/Test/badge.svg)](https://github.com/tonyganchev/eslint-plugin-header)
5
+ [![Build Status](https://github.com/tonyganchev/eslint-plugin-header/actions/workflows/test.yml/badge.svg)](https://github.com/tonyganchev/eslint-plugin-header/actions/workflows/test.yml?query=branch%3Amain)
6
6
 
7
7
  The native ESLint 9/10 standard header-validating plugin. A zero-bloat, drop-in
8
8
  replacement for [eslint-plugin-header](https://github.com/Stuk/eslint-plugin-header)
9
9
  with first-class Flat Config & TypeScript support. Auto-fix copyright, license,
10
- and banner comments in JavaScript and TypeScript files.
10
+ and banner comments in JavaScript and TypeScript files. Supports _oxlint_.
11
11
 
12
12
  ## Table of Contents
13
13
 
14
14
  1. [Motivation and Acknowledgements](#motivation-and-acknowledgements)
15
- 2. [Compatibility](#compatibility)
16
- 3. [Usage](#usage)
15
+ 2. [Major Consumers](#major-consumers)
16
+ 3. [Compatibility](#compatibility)
17
+ 4. [Usage](#usage)
17
18
  1. [File-based Configuration](#file-based-configuration)
18
19
  2. [Inline Configuration](#inline-configuration)
19
20
  1. [Header Contents Configuration](#header-contents-configuration)
@@ -23,14 +24,14 @@ and banner comments in JavaScript and TypeScript files.
23
24
  3. [Support for Leading Comments](#support-for-leading-comments)
24
25
  1. [Notes on Behavior](#notes-on-behavior)
25
26
  4. [Examples](#examples)
26
- 4. [Comparison to Alternatives](#comparison-to-alternatives)
27
+ 5. [Comparison to Alternatives](#comparison-to-alternatives)
27
28
  1. [Compared to eslint-plugin-headers](#compared-to-eslint-plugin-headers)
28
29
  1. [Health Scans](#health-scans)
29
30
  2. [Compared to eslint-plugin-license-header](#compared-to-eslint-plugin-license-header)
30
- 5. [Versioning](#versioning)
31
+ 6. [Versioning](#versioning)
31
32
  1. [What is a Feature?](#what-is-a-feature)
32
33
  2. [What is Backward-compatibility?](#what-is-backward-compatibility)
33
- 6. [License](#license)
34
+ 7. [License](#license)
34
35
 
35
36
  ## Motivation and Acknowledgements
36
37
 
@@ -56,6 +57,44 @@ Multiple other projects took from where _eslint-plugin-header_ left off. A
56
57
  comparison of the current project to these alternatives is available in a
57
58
  dedicated section.
58
59
 
60
+ ## Major Consumers
61
+
62
+ The plugin is used by hundreds of projects to enforce license compliance and
63
+ consistent header structures. Notable adopters include:
64
+
65
+ [![Microsoft](https://github.com/microsoft.png?size=48)](./docs/consumers.md#microsoft)
66
+    
67
+ [![Microsoft Azure](https://github.com/azure.png?size=48)](./docs/consumers.md#azure)
68
+    
69
+ [![Salesforce](https://github.com/forcedotcom.png?size=48)](./docs/consumers.md#salesforce)
70
+    
71
+ [![Angular](https://github.com/angular.png?size=48)](./docs/consumers.md#angular)
72
+    
73
+ [![Amazon](https://github.com/aws.png?size=48)](./docs/consumers.md#amazon)
74
+    
75
+ [![Amazon Cloudscape Design System](https://github.com/cloudscape-design.png?size=48)](./docs/consumers.md#cloudscape-design-system)
76
+    
77
+ [![Eclipse GLSP](https://github.com/eclipse.png?size=48)](./docs/consumers.md#eclipse-foundation)
78
+    
79
+ [![Salto](https://github.com/salto-io.png?size=48)](./docs/consumers.md#salto)
80
+    
81
+ [![Dash0 OpenTelemetry JS Distribution](https://github.com/dash0hq.png?size=48)](./docs/consumers.md#dash0)
82
+    
83
+ [![IBM InspectorRAGet](https://github.com/ibm.png?size=48)](./docs/consumers.md#ibm)
84
+    
85
+ [![FlowCrypt Browser Extensions](https://github.com/flowcrypt.png?size=48)](./docs/consumers.md#flowcrypt)
86
+    
87
+ [![Cratis](https://github.com/Cratis.png?size=48)](./docs/consumers.md#cratis)
88
+    
89
+ [![Mysten Labs](https://github.com/MystenLabs.png?size=48)](./docs/consumers.md#mysten-labs)
90
+    
91
+ [![Wire Swiss GmbH](https://github.com/wireapp.png?size=48)](./docs/consumers.md#wire-swiss-gmbh)
92
+    
93
+ [![WPPConnect](https://github.com/wppconnect-team.png?size=48)](./docs/consumers.md#wppconnect)
94
+
95
+ Learn more about how these organizations use the plugin on our
96
+ [consumers list](./docs/consumers.md).
97
+
59
98
  ## Compatibility
60
99
 
61
100
  The plugin supports **ESLint 7 / 8 / 9 / 10**. Both **flat** config and legacy,
@@ -141,6 +180,34 @@ Due to limitations in ESLint plugins, the file is read relative to the working
141
180
  directory that ESLint is executed in. If you run ESLint from elsewhere in your
142
181
  tree then the header file will not be found.
143
182
 
183
+ The equivalent configuration for _oxlint_ is:
184
+
185
+ ```json
186
+ {
187
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
188
+ "overrides": [
189
+ {
190
+ "files": [
191
+ "**/*.js"
192
+ ],
193
+ "rules": {
194
+ "@tony.ganchev/header/header": [
195
+ "error",
196
+ {
197
+ "header": {
198
+ "file": "config/header.js"
199
+ }
200
+ }
201
+ ]
202
+ },
203
+ "jsPlugins": [
204
+ "@tony.ganchev/eslint-plugin-header"
205
+ ]
206
+ }
207
+ ]
208
+ }
209
+ ```
210
+
144
211
  ### Inline Configuration
145
212
 
146
213
  In this configuration mode, the matching rules for the header are given inline.
@@ -194,6 +261,37 @@ All of the following configurations will match the header:
194
261
  ]);
195
262
  ```
196
263
 
264
+ Equivalent configuration for _oxlint_:
265
+
266
+ ```json
267
+ {
268
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
269
+ "overrides": [
270
+ {
271
+ "files": [
272
+ "**/*.js"
273
+ ],
274
+ "rules": {
275
+ "@tony.ganchev/header/header": [
276
+ "error",
277
+ {
278
+ "header": {
279
+ "commentType": "block",
280
+ "lines": [
281
+ "\n * Copyright (c) 2015\n * My Company\n "
282
+ ]
283
+ }
284
+ }
285
+ ]
286
+ },
287
+ "jsPlugins": [
288
+ "@tony.ganchev/eslint-plugin-header"
289
+ ]
290
+ }
291
+ ]
292
+ }
293
+ ```
294
+
197
295
  Note that the above would work for both Windows and POSIX systems even
198
296
  though the EOL in the header content was specified as `\n`.
199
297
 
@@ -964,11 +964,20 @@ const headerRule = {
964
964
  Program: function () {
965
965
  const sourceCode = contextSourceCode(context);
966
966
  const leadingComments = getLeadingComments(sourceCode);
967
- const hasShebang = leadingComments.length > 0
968
- && /** @type {string} */ (leadingComments[0][0].type) === "Shebang";
967
+ // XXX: the reason we test like this instead of checking the
968
+ // first comment is of type "Shabeng" is because
969
+ // @typecript-eslint/prser does not recognize shebang comments
970
+ // with some TypeScript configuration. Since we are not
971
+ // releasing a major version we do not want to break the current
972
+ // behavior of not be pedantic about the tsconfig.json.
973
+ const hasShebang = sourceCode.text.startsWith("#!");
969
974
  let startingHeaderLine = 1;
970
975
  if (hasShebang) {
971
- leadingComments.splice(0, 1);
976
+ if (leadingComments.length > 0
977
+ && /** @type {string} */ (leadingComments[0][0].type) === "Shebang"
978
+ ) {
979
+ leadingComments.splice(0, 1);
980
+ }
972
981
  startingHeaderLine = 2;
973
982
  }
974
983
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tony.ganchev/eslint-plugin-header",
3
- "version": "3.3.2",
4
- "description": "The native ESLint 9/10 header plugin. A zero-bloat, drop-in replacement for 'eslint-plugin-header' with first-class Flat Config & TypeScript support. Auto-fix Copyright, License, and banner comments in JavaScrip and TypeScript files.",
3
+ "version": "3.3.4",
4
+ "description": "The native ESLint 9/10 header plugin. A zero-bloat, drop-in replacement for 'eslint-plugin-header' with first-class Flat Config & TypeScript support. Auto-fix Copyright, License, and banner comments in JavaScrip and TypeScript files. Supports oxlint.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "exports": {
@@ -26,39 +26,45 @@
26
26
  "@types/json-schema": "^7.0.15",
27
27
  "@types/node": "^25.5.0",
28
28
  "c8": "^11.0.0",
29
- "eslint": "^10.0.3",
29
+ "eslint": "^10.1.0",
30
30
  "eslint-plugin-eslint-plugin": "^7.3.2",
31
- "eslint-plugin-jsdoc": "^62.8.0",
31
+ "eslint-plugin-jsdoc": "^62.8.1",
32
32
  "eslint-plugin-n": "^17.24.0",
33
33
  "globals": "^17.4.0",
34
34
  "markdownlint-cli": "^0.48.0",
35
35
  "mocha": "12.0.0-beta-10",
36
36
  "testdouble": "^3.20.2",
37
37
  "typescript": "^5.9.3",
38
- "typescript-eslint": "^8.57.1"
38
+ "typescript-eslint": "^8.57.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "eslint": ">=7.7.0"
42
42
  },
43
43
  "keywords": [
44
+ "autofix",
45
+ "auto-fix",
46
+ "banner",
47
+ "check",
48
+ "copyright",
49
+ "copyright-header",
44
50
  "eslint",
51
+ "eslintplugin",
45
52
  "eslint-plugin",
46
53
  "eslint9",
54
+ "eslint10",
55
+ "fix",
47
56
  "flat-config",
48
57
  "header",
49
- "copyright",
50
58
  "license",
51
- "banner",
52
- "notice",
53
59
  "license-header",
54
- "copyright-header",
60
+ "linter",
55
61
  "legal",
56
- "gdpr",
57
- "source-header",
58
- "typescript",
62
+ "notice",
63
+ "oxlint",
64
+ "oxc",
59
65
  "react",
60
- "check",
61
- "fix"
66
+ "source-header",
67
+ "typescript"
62
68
  ],
63
69
  "repository": {
64
70
  "type": "git",
@@ -83,7 +89,7 @@
83
89
  "e2e": "pnpm build && mocha --timeout 60000 tests/e2e/*.js",
84
90
  "eslint": "eslint .",
85
91
  "lint": "pnpm eslint && pnpm markdownlint",
86
- "markdownlint": "markdownlint *.md",
92
+ "markdownlint": "markdownlint *.md docs/**/*.md",
87
93
  "test": "pnpm lint && pnpm unit && pnpm e2e",
88
94
  "unit": "c8 --reporter=html --reporter=text --reporter=text-summary --reporter=lcov --check-coverage --100 mocha tests/lib/*.js tests/lib/**/*.js"
89
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../lib/rules/header.js"],"names":[],"mappings":";2BAsCa,iBAAiB;0BACjB,gBAAgB;wBAChB,cAAc;0BACd,gBAAgB;;;;;yBAIhB,IAAI,GAAG,MAAM;;;;;;;;;;aAOZ,MAAM,GAAG,MAAM;;;;;;;;;;;;yBAOhB,MAAM,GAAG,MAAM,GAAG,iBAAiB;;;;;0BAGnC,UAAU,GAAG,UAAU,EAAE;;;;;;+BAEzB,IAAI,GAAG,MAAM,GAAG,SAAS;;;;;6BAGzB;IAAE,WAAW,CAAC,EAAE,gBAAgB,CAAA;CAAE;;;;;0BAElC,OAAO,GAAG,MAAM;;;;;;;;;;UAOf,MAAM;;;;;;;;;;;;;;;iBASN,WAAW;;;;;;WACX,UAAU,EAAE;;;;;;;;;;;;cAQZ,CAAC,eAAe,GAAG,YAAY,CAAC,EAAE;;;;;;;;;;;;;;;;;;YAclC,eAAe,GAAG,YAAY;;;;;;;;;;;;;;;;;4BAU/B,4BAA4B,GAAG,cAAc;oCAK7C,CAAC,QAAQ,EAAE,MAAM,CAAC;4CAClB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC;iCAE5C,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC;yCACvC,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,CAAC;yCAEjE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;iDAEzD,CACV,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc,CACvB;;;;+BACS,CAAC,aAAa,CAAC,GACvB,qBAAqB,GACrB,6BAA6B,GAC7B,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