Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
36161b3
fix: disable rule options schema validation in eslint 9
Jun 10, 2024
14cfbee
change package identity to publish to npm registry
Jul 10, 2024
86100ac
chore: update package-lock
tonyganchev Jun 20, 2025
fe30cb6
Add rules schema
joshkel Jun 20, 2025
2adcca2
chore: bump version
tonyganchev Jun 20, 2025
28232ce
Create npm-publish.yml
tonyganchev Jun 20, 2025
9a77b97
chore: switched to flat ESLint 9 config
tonyganchev Aug 8, 2025
e14bd07
fix: support both settigns and empty line numbers in rule config
tonyganchev Oct 7, 2025
ad668c0
3.1.4
tonyganchev Oct 7, 2025
b28f6a4
devops: adding copyright headers to the source
tonyganchev Oct 7, 2025
e225d5e
devops: coverage report using istanbul
tonyganchev Oct 7, 2025
9c38071
test: enforce unix EOL in tests
tonyganchev Oct 9, 2025
06afcc4
fix: proper emty lines on Windows
tonyganchev Oct 9, 2025
be4f94d
docs: add JSDoc throughout the code
tonyganchev Oct 9, 2025
c77f8f0
test: generate names for invalid test cases
tonyganchev Oct 9, 2025
8326e9c
perf: small optimizations and cleanup
tonyganchev Oct 9, 2025
834f976
3.1.5
tonyganchev Oct 9, 2025
2636599
test: enforce coverage
tonyganchev Oct 9, 2025
2eab025
fixup! test: enforce coverage
tonyganchev Oct 9, 2025
cc882ee
fixup! fixup! test: enforce coverage
tonyganchev Oct 9, 2025
6ed8164
docs: add missing JSDoc in tests for test-utils.js (#13)
tonyganchev Oct 9, 2025
c7f24aa
docs: fix misplaced JSDocs (#15)
tonyganchev Oct 12, 2025
4ff6de1
test: fix test-case-name-generation util to escape EOL characters (#16)
tonyganchev Oct 12, 2025
3576ab7
fix: header is added immediately after shebang - fixes !14 (#17)
tonyganchev Oct 12, 2025
7338cc8
3.1.6 (#18)
tonyganchev Oct 12, 2025
dc0a5e3
test: improve invalid test-case name generation (#19)
tonyganchev Oct 12, 2025
7650159
fix: add header to shebang-only file with no EOL (#20)
tonyganchev Oct 13, 2025
9a3d2f8
test: achieve and enforce 100% code coverage (#21)
tonyganchev Oct 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 0 additions & 94 deletions .eslintrc.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '24.x'
- name: Install dependencies
run: npm ci
- run: npm test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.DS_Store
node_modules
npm-debug.log
yarn.lock
yarn.lock
/coverage
.vscode/
.nyc_output
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 3.1.6

* fix: header is added immediately after shebang - fixes [#14](https://github.com/tonyganchev/eslint-plugin-header/issues/14) by [@tonyganchev](https://github.com/tonyganchev) in [#17](https://github.com/tonyganchev/eslint-plugin-header/pull/7)
# 3.1.5

* fix: proper empty lines on Windows by [@tonyganchev](https://github.com/tonyganchev) in [#7](https://github.com/tonyganchev/eslint-plugin-header/pull/7)

# 3.1.4

* fix: support both settings and empty line numbers in rule config by [@tonyganchev](https://github.com/tonyganchev) in [#2](https://github.com/tonyganchev/eslint-plugin-header/pull/2)

# 3.1.3

* Detailed ESLint 9 validation schema.

# 3.1.2

* Support ESLint 9.

# 3.1.1

* Fix detecting header below shebang comment with Windows EOL (#30)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This is a fork of https://github.com/Stuk/eslint-plugin-header intended to make the plugin work with ESLint v9

eslint-plugin-header
====================

Expand Down
206 changes: 206 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import { defineConfig } from "eslint/config";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import jsdoc from "eslint-plugin-jsdoc";
import header from "./index.js"

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
const compat = new FlatCompat({
baseDirectory: dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

const jsRules = {
extends: [
...compat.extends("eslint:recommended"),
],
plugins: {
header
},
rules: {
indent: [2, 4, {
SwitchCase: 1,
}],

"brace-style": [2, "1tbs"],

camelcase: [2, {
properties: "never",
}],

"callback-return": [2, ["cb", "callback", "next"]],
"comma-spacing": 2,
"comma-style": [2, "last"],
"consistent-return": 2,
curly: [2, "all"],
"default-case": 2,

"dot-notation": [2, {
allowKeywords: true,
}],

"eol-last": 2,
eqeqeq: 2,
"func-style": [2, "declaration"],
"guard-for-in": 2,

"key-spacing": [2, {
beforeColon: false,
afterColon: true,
}],

"new-cap": 2,
"new-parens": 2,
"no-alert": 2,
"no-array-constructor": 2,
"no-caller": 2,
"no-console": 0,
"no-delete-var": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-implied-eval": 2,
"no-invalid-this": 2,
"no-iterator": 2,
"no-label-var": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-mixed-spaces-and-tabs": [2, false],
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-native-reassign": 2,
"no-nested-ternary": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-object": 2,
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-process-exit": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-script-url": 2,
"no-sequences": 2,
"no-shadow": 2,
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
"no-trailing-spaces": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 2,
"no-underscore-dangle": 2,
"no-unused-expressions": 2,

"no-unused-vars": [2, {
vars: "all",
args: "after-used",
}],

"no-use-before-define": 2,
"no-with": 2,
quotes: [2, "double"],
radix: 2,
semi: 2,

"semi-spacing": [2, {
before: false,
after: true,
}],

"keyword-spacing": [2, {
after: true,
}],

"space-before-blocks": 2,
"space-before-function-paren": [2, "never"],
"space-infix-ops": 2,

"space-unary-ops": [2, {
words: true,
nonwords: false,
}],

"spaced-comment": [2, "always", {
exceptions: ["-"],
}],

strict: [2, "global"],

"wrap-iife": 2,
yoda: [2, "never"],
"no-catch-shadow": 0,
"no-mixed-requires": 2,
"no-new-require": 2,
"no-path-concat": 2,
"global-strict": [0, "always"],
"handle-callback-err": [2, "err"],

'header/header': [
'error',
'block',
[
'',
' * MIT License',
' *',
{
pattern: ' * Copyright \\(c\\) \\d{4}-present .* and contributors',
template: ' * Copyright (c) 2025-present Tony Ganchev and contributors',
},
' *',
' * Permission is hereby granted, free of charge, to any person obtaining a copy',
' * of this software and associated documentation files (the “Software”), to deal',
' * in the Software without restriction, including without limitation the rights',
' * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell',
' * copies of the Software, and to permit persons to whom the Software is',
' * furnished to do so, subject to the following conditions:',
' *',
' * The above copyright notice and this permission notice shall be included in all',
' * copies or substantial portions of the Software.',
' *',
' * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR',
' * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,',
' * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE',
' * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER',
' * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,',
' * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE',
' * SOFTWARE.',
' '
],
2
]
}
};

export default defineConfig([
jsdoc.configs["flat/recommended"],
{
files: ["lib/**/*.js"],
languageOptions: {
sourceType: "commonjs",
globals: {
...globals.node,
},
},
...jsRules,
},
{
files: ["tests/lib/**/*.js"],
languageOptions: {
sourceType: "script",
globals: {
...globals.node,
...globals.mocha,
},
},
...jsRules,
},
]);
Loading