@tony.ganchev/eslint-plugin-header 3.4.0 → 3.4.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/README.md CHANGED
@@ -7,7 +7,7 @@
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, TypeScript, CSS, HTML, and Markdown files.
10
+ and banner comments in JavaScript, TypeScript, Vue, CSS, HTML, and Markdown files.
11
11
  Supports _oxlint_.
12
12
 
13
13
  ## Table of Contents
@@ -30,11 +30,13 @@ Supports _oxlint_.
30
30
  4. [Examples](#examples)
31
31
  5. [Linting CSS](#linting-css)
32
32
  6. [Linting HTML](#linting-html)
33
- 7. [Linting Markdown](#linting-markdown)
33
+ 7. [Linting Vue](#linting-vue)
34
+ 8. [Linting Markdown](#linting-markdown)
34
35
  5. [Comparison to Alternatives](#comparison-to-alternatives)
35
36
  1. [Compared to eslint-plugin-headers](#compared-to-eslint-plugin-headers)
36
37
  1. [Health Scans](#health-scans)
37
38
  2. [Compared to eslint-plugin-license-header](#compared-to-eslint-plugin-license-header)
39
+ 3. [Compared to eslint-plugin-notice](#compared-to-eslint-plugin-notice)
38
40
  6. [Versioning](#versioning)
39
41
  1. [What is a Feature?](#what-is-a-feature)
40
42
  2. [What is Backward-compatibility?](#what-is-backward-compatibility)
@@ -117,7 +119,7 @@ copyright headers in CSS, HTML, or Markdown rely on APIs introduced with ESLint
117
119
  The plugin works with latest version of **oxlint** too. We have a smoke-test
118
120
  running to confirm the plugin works with the latest version of oxlint. Features
119
121
  relying on the use of non-standard parsers such as linting headers in CSS, HTML,
120
- or Markdown cannot be supported.
122
+ Vue, or Markdown cannot be supported.
121
123
 
122
124
  ### Configuration Formats
123
125
 
@@ -131,7 +133,7 @@ statements. Smoke tests cover this support as well.
131
133
  ### Languages
132
134
 
133
135
  Currently the plugin supports linting copyright headers in JavaScript,
134
- TypeScript and their JSX / TSX flavors; CSS, HTML, and Markdown files. As
136
+ TypeScript and their JSX / TSX flavors; Vue, CSS, HTML, and Markdown files. As
135
137
  mentioned in the previous sections, not all languages are supported for oxlint
136
138
  or ESLint older than 9. Refer to the table below for more details.
137
139
 
@@ -141,6 +143,7 @@ or ESLint older than 9. Refer to the table below for more details.
141
143
  | TypeScript | ✅ Yes | ✅ Yes | ✅ Yes |
142
144
  | JSX | ✅ Yes | ✅ Yes | ✅ Yes |
143
145
  | TSX | ✅ Yes | ✅ Yes | ✅ Yes |
146
+ | Vue | ✅ Yes | ✅ Yes | ❌ No |
144
147
  | CSS | ❌ No | ✅ Yes | ❌ No |
145
148
  | HTML | ❌ No | ✅ Yes | ❌ No |
146
149
  | Markdown | ❌ No | ✅ Yes | ❌ No |
@@ -1328,6 +1331,54 @@ export default [
1328
1331
 
1329
1332
  As with CSS, only block comments are supported - no line- or shebang comments.
1330
1333
 
1334
+ ### Linting Vue
1335
+
1336
+ The rule supports linting copyright notices in Vue files. The rule works with
1337
+ the _eslint-plugin-vue_ plugin and its parser.
1338
+
1339
+ To turn on header validation for Vue files, configure the parser, the plugin,
1340
+ and the rule:
1341
+
1342
+ ```ts
1343
+ import header from "@tony.ganchev/eslint-plugin-header";
1344
+ import vueParser from "vue-eslint-parser";
1345
+ import vuePlugin from "eslint-plugin-vue";
1346
+
1347
+ export default [
1348
+ {
1349
+ files: ["**/*.vue"],
1350
+ plugins: {
1351
+ "@tony.ganchev": header,
1352
+ vue: vuePlugin
1353
+ },
1354
+ languageOptions: {
1355
+ parser: vueParser
1356
+ },
1357
+ rules: {
1358
+ "@tony.ganchev/header": [
1359
+ "error",
1360
+ {
1361
+ header: {
1362
+ commentType: "block",
1363
+ lines: [" Copyright 2025 "]
1364
+ }
1365
+ }
1366
+ ]
1367
+ }
1368
+ }
1369
+ ];
1370
+ ```
1371
+
1372
+ ```vue
1373
+ <!-- Copyright 2025 -->
1374
+ <template>
1375
+ <div>Hello, world!</div>
1376
+ </template>
1377
+ ```
1378
+
1379
+ As with HTML and CSS, only block comments are supported at the top of the file -
1380
+ no line- or shebang comments.
1381
+
1331
1382
  ### Linting Markdown
1332
1383
 
1333
1384
  The rule supports copyright comments in Markdown syntax in both _commonmark_ and
@@ -1403,12 +1454,16 @@ _eslint-plugin-header_ and all plugins that already use the latter can migrate
1403
1454
  to the fork right away. At the same time, it provides improved user experience
1404
1455
  and windows support.
1405
1456
 
1406
- eslint-plugin-headers is not a drop-in replacement. It offers additional
1407
- features. Some of them, such as support for Vue templates do not have an
1408
- analogue in the current version of _\@tony.ganchev/eslint-plugin-header_ while
1409
- others such as `{year}` variable placeholders are redundant in the world of
1410
- ESLint 9's flat, JavaScript-based configuration as [already pointed out in this
1411
- document](#providing-to-year-in-auto-fix).
1457
+ _eslint-plugin-headers_ is not a drop-in replacement. It offers additional
1458
+ features that are not first-level use-cases for
1459
+ _\@tony.ganchev/eslint-plugin-header_. One example is support for `{year}`
1460
+ variable placeholders which are redundant with ESLint's JavaScript-based
1461
+ configuration as [already pointed out in this document](#providing-to-year-in-auto-fix).
1462
+ JSDoc support can be achieved with regular expressions and the overall
1463
+ configuration capabilities of _\@tony.ganchev/eslint-plugin-header_. It is worth
1464
+ noting that the source code of _\@tony.ganchev/eslint-plugin-header_ already
1465
+ uses JSDoc-style comments for its own header which are in turn validated using
1466
+ _\@tony.ganchev/eslint-plugin-header/header_ rule.
1412
1467
 
1413
1468
  The configuration format philosophy of the two plugin differs.
1414
1469
  _\@tony.ganchev/eslint-plugin-header_ supports both the legacy model inherited
@@ -1475,6 +1530,30 @@ We have prepared a detailed
1475
1530
  [migration guide](docs/migrate-from-license-header.md) for anyone eager to
1476
1531
  migrate to _\@tony.ganchev/eslint-plugin-header_.
1477
1532
 
1533
+ ### Compared to [eslint-plugin-notice](https://github.com/earl-man/eslint-plugin-notice)
1534
+
1535
+ _eslint-plugin-notice_ is another alternative that uses a template-based approach
1536
+ (powered by Lodash templates) to manage headers. This makes it quite powerful for
1537
+ dynamic content but also brings in more dependencies and a more complex
1538
+ configuration schema that doesn't always feel "native" to the new ESLint Flat
1539
+ Config era.
1540
+
1541
+ Key differences:
1542
+
1543
+ - **Philosophy**: _\@tony.ganchev/eslint-plugin-header_ focuses on a zero-bloat,
1544
+ native ESLint feel with first-class support for Flat Config and TypeScript.
1545
+ - **ESLint 9/10**: Our plugin is built from the ground up to support the latest
1546
+ ESLint versions and their core features.
1547
+ - **Languages**: We provide native support for linting headers in HTML, CSS,
1548
+ and Markdown via their respective ESLint ecosystem plugins.
1549
+ - **Simplicity**: No need for external template engines or complex variable
1550
+ mappings. Use standard JavaScript template literals in your `eslint.config.ts`
1551
+ to handle dynamic years or other variables.
1552
+
1553
+ We have prepared a detailed
1554
+ [migration guide](docs/migrate-from-notice.md) for anyone eager to
1555
+ migrate to _\@tony.ganchev/eslint-plugin-header_.
1556
+
1478
1557
  ## Versioning
1479
1558
 
1480
1559
  The project follows standard [NPM semantic versioning policy](
@@ -1208,7 +1208,10 @@ const headerRule = {
1208
1208
  const hooks = {
1209
1209
  Program: () =>
1210
1210
  onRootNode(
1211
- sourceCode.constructor.name === "HTMLSourceCode"
1211
+ (sourceCode.constructor.name === "HTMLSourceCode"
1212
+ // Vue parser mimics JS parser identity but has a
1213
+ // template section.
1214
+ || "templateBody" in sourceCode.ast)
1212
1215
  ? htmlStyleLanguage
1213
1216
  : jsStyleLanguage
1214
1217
  ),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tony.ganchev/eslint-plugin-header",
3
- "version": "3.4.0",
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, TypeScript, CSS, HTML, and Markdown files. Supports oxlint.",
3
+ "version": "3.4.1",
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 JavaScript, TypeScript, Vue, CSS, HTML, and Markdown files. Supports oxlint.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "exports": {
@@ -32,12 +32,14 @@
32
32
  "eslint-plugin-eslint-plugin": "^7.3.2",
33
33
  "eslint-plugin-jsdoc": "^62.9.0",
34
34
  "eslint-plugin-n": "^17.24.0",
35
+ "eslint-plugin-vue": "^10.8.0",
35
36
  "globals": "^17.4.0",
36
37
  "markdownlint-cli": "^0.48.0",
37
38
  "mocha": "12.0.0-beta-10",
38
39
  "testdouble": "^3.20.2",
39
40
  "typescript": "^5.9.3",
40
- "typescript-eslint": "^8.58.0"
41
+ "typescript-eslint": "^8.58.0",
42
+ "vue-eslint-parser": "^10.4.0"
41
43
  },
42
44
  "peerDependencies": {
43
45
  "eslint": ">=7.7.0"
@@ -74,7 +76,10 @@
74
76
  "oxc",
75
77
  "react",
76
78
  "source-header",
77
- "typescript"
79
+ "typescript",
80
+ "vue",
81
+ "vuejs",
82
+ "vue-js"
78
83
  ],
79
84
  "repository": {
80
85
  "type": "git",
@@ -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,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