@tony.ganchev/eslint-plugin-header 3.3.1 → 3.3.3

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
@@ -58,12 +58,16 @@ dedicated section.
58
58
 
59
59
  ## Compatibility
60
60
 
61
- The plugin supports ESLint 7 / 8 / 9 / 10. Both flat config and legacy,
62
- hierarchical config can be used.
61
+ The plugin supports **ESLint 7 / 8 / 9 / 10**. Both **flat** config and legacy,
62
+ **hierarchical** config can be used. We have a smoke-test running to confirm the
63
+ plugin works with the latest version of ESLint.
64
+
65
+ The plugin works with latest version of **oxlint** too. We have a smoke-test
66
+ running to confirm the plugin works with the latest version of oxlint.
63
67
 
64
68
  The NPM package provides TypeScript type definitions and can be used with
65
69
  TypeScript-based ESLint flat configuration without the need for `@ts-ignore`
66
- statements.
70
+ statements. Smoke tests cover this support as well.
67
71
 
68
72
  ## Usage
69
73
 
@@ -898,15 +898,6 @@ const headerRule = {
898
898
  },
899
899
  fixable: "whitespace",
900
900
  schema,
901
- defaultOptions: [
902
- /** @type {AllHeaderOptions} */
903
- {
904
- lineEndings: lineEndingOptions.os,
905
- trailingEmptyLines: {
906
- minimum: 1
907
- }
908
- }
909
- ],
910
901
  messages: {
911
902
  // messages customized for header validation.
912
903
  headerLineMismatchAtPos:
@@ -973,11 +964,20 @@ const headerRule = {
973
964
  Program: function () {
974
965
  const sourceCode = contextSourceCode(context);
975
966
  const leadingComments = getLeadingComments(sourceCode);
976
- const hasShebang = leadingComments.length > 0
977
- && /** @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("#!");
978
974
  let startingHeaderLine = 1;
979
975
  if (hasShebang) {
980
- leadingComments.splice(0, 1);
976
+ if (leadingComments.length > 0
977
+ && /** @type {string} */ (leadingComments[0][0].type) === "Shebang"
978
+ ) {
979
+ leadingComments.splice(0, 1);
980
+ }
981
981
  startingHeaderLine = 2;
982
982
  }
983
983
 
@@ -98,7 +98,7 @@ const schema = Object.freeze({
98
98
  type: "string",
99
99
  enum: [lineEndingOptions.unix, lineEndingOptions.windows, lineEndingOptions.os],
100
100
  description: "Line endings to use when aut-fixing the violations. Defaults to 'os' which means 'same as " +
101
- "system'."
101
+ "system'."
102
102
  },
103
103
  settings: {
104
104
  type: "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tony.ganchev/eslint-plugin-header",
3
- "version": "3.3.1",
3
+ "version": "3.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.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -35,7 +35,7 @@
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.0"
38
+ "typescript-eslint": "^8.57.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "eslint": ">=7.7.0"