@hs-web-team/eslint-config-node 3.2.0-next.5 → 3.2.0-next.6
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/CLAUDE.md +1 -1
- package/cypress.config.cjs +1 -0
- package/cypress.config.d.ts +18 -0
- package/examples/cypress-usage.md +11 -6
- package/package.json +12 -2
package/CLAUDE.md
CHANGED
|
@@ -111,7 +111,7 @@ When testing changes to this package in downstream projects, you'll typically:
|
|
|
111
111
|
- Browser export (`./browser`): `browser.js` - Browser/React ESLint configuration
|
|
112
112
|
- Prettier export (`./.prettierrc.json`): `.prettierrc.json` - Prettier configuration
|
|
113
113
|
- Stylelint export (`./.stylelintrc.json`): `.stylelintrc.json` - Stylelint configuration
|
|
114
|
-
- Cypress export (`./cypress.config`): `cypress.config.cjs`
|
|
114
|
+
- Cypress export (`./cypress.config`): `cypress.config.cjs` (runtime), `cypress.config.d.ts` (types)
|
|
115
115
|
- **Binary command**: `add-prettier` maps to `bin/add-prettier-scripts.js`
|
|
116
116
|
|
|
117
117
|
### Migration Context
|
package/cypress.config.cjs
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
export declare const envs: {
|
|
4
|
+
currentEnv: string;
|
|
5
|
+
DEV: string;
|
|
6
|
+
QA: string;
|
|
7
|
+
PROD: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export declare const config: Cypress.ConfigOptions;
|
|
11
|
+
|
|
12
|
+
export declare function setupNodeEvents(
|
|
13
|
+
on: Cypress.PluginEvents,
|
|
14
|
+
config: Cypress.PluginConfigOptions
|
|
15
|
+
): Promise<Cypress.PluginConfigOptions>;
|
|
16
|
+
|
|
17
|
+
export declare function getDevBaseUrl(): string | null;
|
|
18
|
+
export declare function getBaseUrls(): Record<string, string | null> | null;
|
|
@@ -221,19 +221,22 @@ module.exports = defineConfig({
|
|
|
221
221
|
|
|
222
222
|
### Add Custom setupNodeEvents
|
|
223
223
|
|
|
224
|
+
`setupNodeEvents` is exported directly and is also embedded inside `config.e2e`. If you override it without calling the package's version first, you'll silently lose the Cucumber preprocessor and esbuild setup.
|
|
225
|
+
|
|
226
|
+
Import `setupNodeEvents` directly and call it before your own logic:
|
|
227
|
+
|
|
224
228
|
```javascript
|
|
225
229
|
const { defineConfig } = require('cypress');
|
|
226
|
-
const { config } = require('@hs-web-team/eslint-config-node/cypress.config');
|
|
230
|
+
const { config, setupNodeEvents: wtSetupNodeEvents } = require('@hs-web-team/eslint-config-node/cypress.config');
|
|
227
231
|
|
|
228
232
|
module.exports = defineConfig({
|
|
229
233
|
...config,
|
|
230
234
|
e2e: {
|
|
231
235
|
...config.e2e,
|
|
232
|
-
async setupNodeEvents(on,
|
|
233
|
-
//
|
|
234
|
-
|
|
236
|
+
async setupNodeEvents(on, cfg) {
|
|
237
|
+
// sets up esbuild preprocessor and Cucumber
|
|
238
|
+
await wtSetupNodeEvents(on, cfg);
|
|
235
239
|
|
|
236
|
-
// Add your custom tasks/events
|
|
237
240
|
on('task', {
|
|
238
241
|
log(message) {
|
|
239
242
|
console.log(message);
|
|
@@ -241,12 +244,14 @@ module.exports = defineConfig({
|
|
|
241
244
|
},
|
|
242
245
|
});
|
|
243
246
|
|
|
244
|
-
return
|
|
247
|
+
return cfg;
|
|
245
248
|
},
|
|
246
249
|
},
|
|
247
250
|
});
|
|
248
251
|
```
|
|
249
252
|
|
|
253
|
+
If you don't need custom node events, omit `setupNodeEvents` entirely and just spread `...config.e2e` — the package's setup runs automatically.
|
|
254
|
+
|
|
250
255
|
## Integration with CI/CD
|
|
251
256
|
|
|
252
257
|
### GitHub Actions Example
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hs-web-team/eslint-config-node",
|
|
3
|
-
"version": "3.2.0-next.
|
|
3
|
+
"version": "3.2.0-next.6",
|
|
4
4
|
"description": "HubSpot Marketing WebTeam shared configurations for ESLint, Prettier, Stylelint, and Cypress",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,17 @@
|
|
|
9
9
|
"./browser": "./browser.js",
|
|
10
10
|
"./.prettierrc.json": "./.prettierrc.json",
|
|
11
11
|
"./.stylelintrc.json": "./.stylelintrc.json",
|
|
12
|
-
"./cypress.config":
|
|
12
|
+
"./cypress.config": {
|
|
13
|
+
"types": "./cypress.config.d.ts",
|
|
14
|
+
"require": "./cypress.config.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"typesVersions": {
|
|
18
|
+
"*": {
|
|
19
|
+
"cypress.config": [
|
|
20
|
+
"./cypress.config.d.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
13
23
|
},
|
|
14
24
|
"scripts": {
|
|
15
25
|
"lint": "npx eslint -c ./index.js *.js --fix",
|