@hs-web-team/eslint-config-node 4.2.2 → 5.1.0
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/.stylelintrc.json +6 -3
- package/README.md +33 -0
- package/base-rules.js +61 -0
- package/bin/check-peer-deps.cjs +1 -1
- package/bin/gherkin-tag-coverage.js +62 -0
- package/browser.js +13 -62
- package/cypress.config.cjs +10 -11
- package/docs/adr/0001-lint-claude-md-with-eslint.md +123 -0
- package/docs/adr/0002-extend-max-lines-to-skill-md.md +105 -0
- package/examples/browser-usage.md +20 -0
- package/examples/claude-code-usage.md +73 -0
- package/examples/custom-rules.md +98 -0
- package/examples/gherkin-usage.md +133 -0
- package/gherkin/.gplintrc +32 -0
- package/gherkin/coverage-config.js +10 -0
- package/gherkin/load-config.js +23 -0
- package/gherkin/suite-coverage.js +126 -0
- package/index.js +12 -55
- package/package.json +54 -24
- package/plugins/claude-code/index.js +50 -0
- package/plugins/claude-code/rules/max-lines.js +52 -0
- package/plugins/hs-web-team/index.js +24 -0
- package/plugins/hs-web-team/rules/no-abbreviations.js +135 -0
- package/plugins/hs-web-team/rules/no-non-literal-constant-case.js +137 -0
- package/plugins/hs-web-team/rules/no-reduce-accumulator-copy.js +90 -0
- package/.githooks/commit-msg +0 -28
- package/.github/CODEOWNERS +0 -1
- package/.github/workflows/main.yml +0 -24
- package/.github/workflows/pr.yml +0 -24
- package/.github/workflows/release-please.yml +0 -44
- package/.nvmrc +0 -1
- package/.release-please-manifest.json +0 -3
- package/CHANGELOG.md +0 -23
- package/CLAUDE.md +0 -145
- package/release-please-config.json +0 -8
package/.github/workflows/pr.yml
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
name: Pull Request
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches: [main]
|
|
6
|
-
workflow_dispatch:
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
# The type of runner that the job will run on
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
strategy:
|
|
13
|
-
matrix:
|
|
14
|
-
node: [24]
|
|
15
|
-
|
|
16
|
-
name: Node ${{ matrix.node }} sample
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v6
|
|
19
|
-
- name: Run unit tests
|
|
20
|
-
uses: actions/setup-node@v6
|
|
21
|
-
with:
|
|
22
|
-
node-version: ${{ matrix.node }}
|
|
23
|
-
- run: npm install
|
|
24
|
-
- run: npm run lint
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
name: Release Please
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
contents: write
|
|
9
|
-
pull-requests: write
|
|
10
|
-
id-token: write # Required for OIDC npm publish
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
release-please:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
outputs:
|
|
16
|
-
release_created: ${{ steps.release.outputs.release_created }}
|
|
17
|
-
steps:
|
|
18
|
-
- uses: googleapis/release-please-action@v5
|
|
19
|
-
id: release
|
|
20
|
-
with:
|
|
21
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
-
|
|
23
|
-
publish:
|
|
24
|
-
needs: release-please
|
|
25
|
-
if: ${{ needs.release-please.outputs.release_created == 'true' }}
|
|
26
|
-
runs-on: ubuntu-latest
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v6
|
|
29
|
-
- uses: actions/setup-node@v6
|
|
30
|
-
with:
|
|
31
|
-
node-version: 24
|
|
32
|
-
registry-url: 'https://registry.npmjs.org'
|
|
33
|
-
- run: npm ci
|
|
34
|
-
- run: npm run build --if-present
|
|
35
|
-
- name: Publish to npm
|
|
36
|
-
run: |
|
|
37
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
38
|
-
if [[ "$VERSION" =~ -next\. ]] || [[ "$VERSION" =~ -(alpha|beta|rc)\. ]]; then
|
|
39
|
-
echo "Publishing prerelease $VERSION with tag 'next'"
|
|
40
|
-
npm publish --tag next
|
|
41
|
-
else
|
|
42
|
-
echo "Publishing stable $VERSION"
|
|
43
|
-
npm publish
|
|
44
|
-
fi
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v24
|
package/CHANGELOG.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [4.2.2](https://github.com/HubSpotWebTeam/wt-eslint-node/compare/v4.2.1...v4.2.2) (2026-06-18)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Bug Fixes
|
|
7
|
-
|
|
8
|
-
* add default export condition for cypress.config subpath ([a15f847](https://github.com/HubSpotWebTeam/wt-eslint-node/commit/a15f847cc00430dec3ec59cc5c4cccabcabee2a1))
|
|
9
|
-
* add default export condition for cypress.config subpath ([41679a9](https://github.com/HubSpotWebTeam/wt-eslint-node/commit/41679a98cba0c514f8b66bd2495ec040c1a27775))
|
|
10
|
-
|
|
11
|
-
## [4.2.1](https://github.com/HubSpotWebTeam/wt-eslint-node/compare/v4.2.0...v4.2.1) (2026-06-05)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### Bug Fixes
|
|
15
|
-
|
|
16
|
-
* re-trigger publish after release-please CI fix ([45fe949](https://github.com/HubSpotWebTeam/wt-eslint-node/commit/45fe94930c06d61e6f8f3015bc4e6518e187aaa1))
|
|
17
|
-
|
|
18
|
-
## [4.2.0](https://github.com/HubSpotWebTeam/wt-eslint-node/compare/v4.1.0...v4.2.0) (2026-06-05)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Features
|
|
22
|
-
|
|
23
|
-
* warn on hardcoded color, font-size, and font-weight values ([#37](https://github.com/HubSpotWebTeam/wt-eslint-node/issues/37)) ([783a320](https://github.com/HubSpotWebTeam/wt-eslint-node/commit/783a320a3d0e858cd370670be452aaa847ba9c39))
|
package/CLAUDE.md
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This is a configuration package (`@hs-web-team/eslint-config-node`) for HubSpot Marketing WebTeam projects. It provides shared configurations for:
|
|
8
|
-
- **ESLint** rules for Node.js and browser/React projects
|
|
9
|
-
- **Prettier** formatting configuration
|
|
10
|
-
- **Stylelint** rules for SCSS/CSS linting
|
|
11
|
-
- **Cypress** E2E testing configuration
|
|
12
|
-
|
|
13
|
-
## Key Commands
|
|
14
|
-
|
|
15
|
-
### Linting
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm run lint
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Runs ESLint on the codebase with auto-fix enabled. Uses the configuration defined in `index.js`.
|
|
22
|
-
|
|
23
|
-
### Testing in Projects
|
|
24
|
-
When testing changes to this package in downstream projects, you'll typically:
|
|
25
|
-
1. Make changes to the ESLint config in `index.js`
|
|
26
|
-
2. Run `npm link` in this repository
|
|
27
|
-
3. Run `npm link @hs-web-team/eslint-config-node` in the consuming project
|
|
28
|
-
4. Test the linting behavior in the consuming project
|
|
29
|
-
|
|
30
|
-
## Architecture
|
|
31
|
-
|
|
32
|
-
### Core Configuration Files
|
|
33
|
-
|
|
34
|
-
#### `index.js` - Node.js Configuration
|
|
35
|
-
- The main ESLint configuration export using ESLint 9's flat config format
|
|
36
|
-
- Uses `@eslint/js`, `typescript-eslint`, and `globals` packages
|
|
37
|
-
- Exports an array of configuration objects (flat config format)
|
|
38
|
-
- Structure:
|
|
39
|
-
1. Global ignores object
|
|
40
|
-
2. `js.configs.recommended` for JavaScript baseline
|
|
41
|
-
3. JavaScript-specific config for `**/*.{js,mjs,cjs}` files
|
|
42
|
-
4. Spreads `tseslint.configs.recommended` for TypeScript baseline
|
|
43
|
-
5. TypeScript-specific config for `**/*.{ts,mts,cts,tsx}` files
|
|
44
|
-
- Includes Node.js, ES2022, and Jest globals
|
|
45
|
-
- Common ignores: `node_modules`, `.serverless`, `.webpack`, `dist`, `eslint.config.js`
|
|
46
|
-
- Key custom rules: `no-console` (allows info/warn/error), `max-len` (120 chars), camelcase disabled
|
|
47
|
-
|
|
48
|
-
#### `browser.js` - Browser/React Configuration
|
|
49
|
-
- Browser and React-focused ESLint configuration using ESLint 9's flat config format
|
|
50
|
-
- Uses `@eslint/js`, `typescript-eslint`, `globals`, and React-specific plugins
|
|
51
|
-
- Includes `eslint-plugin-react`, `eslint-plugin-react-hooks`, and `eslint-plugin-jsx-a11y`
|
|
52
|
-
- Supports both JavaScript/JSX and TypeScript/TSX files
|
|
53
|
-
- Structure:
|
|
54
|
-
1. Global ignores (node_modules, dist, build, .next, coverage)
|
|
55
|
-
2. Base JavaScript/JSX config with browser globals
|
|
56
|
-
3. React plugin configuration
|
|
57
|
-
4. TypeScript config with browser globals
|
|
58
|
-
5. React plugin configuration for TypeScript files
|
|
59
|
-
- Includes browser, ES2021, and Jest globals, plus custom globals ($, jQuery, Invoca)
|
|
60
|
-
- Key custom rules: Similar base rules to Node config, plus React-specific rules
|
|
61
|
-
|
|
62
|
-
### Prettier Integration
|
|
63
|
-
- **`bin/add-prettier-scripts.js`**: Executable script that consuming projects can run to set up Prettier
|
|
64
|
-
- Uses CommonJS (`require`) syntax (different from the main package which is ESM)
|
|
65
|
-
- Adds `prettier:check` and `prettier:write` scripts to package.json
|
|
66
|
-
- Creates `.prettierrc.js` file that imports from this package's `.prettierrc.json`
|
|
67
|
-
- Creates `.prettierignore` file with sensible defaults (npm-shrinkwrap.json, package-lock.json, .eslintrc, *.html)
|
|
68
|
-
- **`.prettierrc.json`**: Shared Prettier configuration
|
|
69
|
-
- 120 char width, single quotes, 2-space tabs, trailing commas
|
|
70
|
-
- Arrow parens: avoid, LF line endings, single attribute per line
|
|
71
|
-
- Override for YAML files: uses double quotes instead of single
|
|
72
|
-
|
|
73
|
-
### Stylelint Configuration
|
|
74
|
-
- **`.stylelintrc.json`**: Shared Stylelint configuration for SCSS/CSS linting
|
|
75
|
-
- Extends `stylelint-config-standard-scss` for standard SCSS linting rules
|
|
76
|
-
- Customized rules for HubSpot projects:
|
|
77
|
-
- Disables strict class name patterns and variable naming patterns
|
|
78
|
-
- Allows zero units (e.g., `0px`), redundant longhand properties, and duplicate selectors
|
|
79
|
-
- Configures SCSS-specific rules to ignore common directives (`@function`, `@if`, `@mixin`, etc.)
|
|
80
|
-
- Enforces lowercase keywords with camelCase for SVG keywords
|
|
81
|
-
- Sets media feature range notation to "context" with warning severity
|
|
82
|
-
- Consuming projects extend this via `.stylelintrc.json`: `{ "extends": "@hs-web-team/eslint-config-node/.stylelintrc.json" }`
|
|
83
|
-
- Documentation: `examples/stylelint-usage.md`
|
|
84
|
-
|
|
85
|
-
### Cypress Configuration
|
|
86
|
-
- **`cypress.config.cjs`**: Shared Cypress configuration for E2E testing
|
|
87
|
-
- Uses CommonJS (`require`) syntax
|
|
88
|
-
- Core settings:
|
|
89
|
-
- Disables Chrome web security for cross-origin testing
|
|
90
|
-
- Timeouts: 20s default command, page load, and response timeouts
|
|
91
|
-
- Viewport: 1920x1080
|
|
92
|
-
- Retries: 1 retry in run mode, 0 in open mode
|
|
93
|
-
- Screenshots on failure enabled, video disabled by default
|
|
94
|
-
- Uses **esbuild** preprocessor for fast bundling (much faster than webpack)
|
|
95
|
-
- Includes Cucumber preprocessor setup with native esbuild support
|
|
96
|
-
- Native TypeScript support via esbuild (no additional loader needed)
|
|
97
|
-
- `@badeball/cypress-cucumber-preprocessor`, `@bahmutov/cypress-esbuild-preprocessor`, `esbuild`, and `js-yaml` are all bundled — consumers only need to install `cypress`
|
|
98
|
-
- Spec pattern: `cypress/e2e/*.cy.js`
|
|
99
|
-
- Exported utilities:
|
|
100
|
-
- `config`: Main Cypress configuration object
|
|
101
|
-
- `envs`: Environment constants (DEV, QA, PROD)
|
|
102
|
-
- `getDevBaseUrl()`: Reads baseUrl from `hubspot.config.yml` DEV portal
|
|
103
|
-
- `getBaseUrls()`: Reads URLs from `.ci/config.yml` for multiple environments
|
|
104
|
-
- HubSpot-specific: Designed to work with HubSpot CMS projects using `hubspot.config.yml`
|
|
105
|
-
- Documentation: `examples/cypress-usage.md`
|
|
106
|
-
|
|
107
|
-
### Package Details
|
|
108
|
-
- **Type**: ESM module (`"type": "module"`)
|
|
109
|
-
- **Node requirement**: >= 24
|
|
110
|
-
- **Exports**:
|
|
111
|
-
- Main export (`.`): `index.js` - Node.js ESLint configuration
|
|
112
|
-
- Browser export (`./browser`): `browser.js` - Browser/React ESLint configuration
|
|
113
|
-
- Prettier export (`./.prettierrc.json`): `.prettierrc.json` - Prettier configuration
|
|
114
|
-
- Stylelint export (`./.stylelintrc.json`): `.stylelintrc.json` - Stylelint configuration
|
|
115
|
-
- Cypress export (`./cypress.config`): `cypress.config.cjs` (runtime), `cypress.config.d.ts` (types)
|
|
116
|
-
- **Binary command**: `add-prettier` maps to `bin/add-prettier-scripts.js`
|
|
117
|
-
|
|
118
|
-
### Migration Context
|
|
119
|
-
This package is currently on v3, which uses ESLint 9's flat config format. The project has migrated from:
|
|
120
|
-
- v1 → v2: See `docs/MIGRATION-V2.md`
|
|
121
|
-
- v2 → v3: See `docs/MIGRATION-V3.md` (ESLint 9 flat config migration requiring Node.js 24+)
|
|
122
|
-
|
|
123
|
-
## Important Notes
|
|
124
|
-
|
|
125
|
-
- This package supports multiple use cases:
|
|
126
|
-
- **ESLint**: Backend Node.js projects (default export) and browser/React projects (`/browser` export)
|
|
127
|
-
- **Prettier**: Code formatting (`./.prettierrc.json` export)
|
|
128
|
-
- **Stylelint**: SCSS/CSS linting (`./.stylelintrc.json` export)
|
|
129
|
-
- **Cypress**: E2E testing (`./cypress.config` export)
|
|
130
|
-
- ESLint configuration uses ESLint 9's flat config format (not the legacy `.eslintrc` format)
|
|
131
|
-
- Downstream projects extend configs:
|
|
132
|
-
- ESLint (Node.js): `...wtConfig` in `eslint.config.js`
|
|
133
|
-
- ESLint (Browser): `...wtBrowserConfig` in `eslint.config.js`
|
|
134
|
-
- Prettier: Import via `.prettierrc.js` using `require('@hs-web-team/eslint-config-node/.prettierrc.json')`
|
|
135
|
-
- Stylelint: Extend in `.stylelintrc.json` with `"extends": "@hs-web-team/eslint-config-node/.stylelintrc.json"`
|
|
136
|
-
- Cypress: Import and spread in `cypress.config.js`
|
|
137
|
-
- Mixed module systems:
|
|
138
|
-
- Main package is ESM (`index.js`, `browser.js`)
|
|
139
|
-
- Utility scripts use CommonJS (`bin/add-prettier-scripts.js`, `cypress.config.cjs`)
|
|
140
|
-
- CI runs on Node 24 (see `.github/workflows/pr.yml`)
|
|
141
|
-
- No automated tests currently (`npm test` will fail with "Error: no test specified")
|
|
142
|
-
- Detailed documentation available in `examples/`:
|
|
143
|
-
- `browser-usage.md` - Browser/React ESLint configuration
|
|
144
|
-
- `stylelint-usage.md` - Stylelint configuration
|
|
145
|
-
- `cypress-usage.md` - Cypress E2E testing configuration
|