This package provides ESLint rules and configurations for Hubspot Marketing WebTeam projects, supporting both Node.js backend and browser/React applications.
-
Install as dev dependency
npm i -D @hs-web-team/eslint-config-node@latest
-
Add to
eslint.config.jsin project root directoryimport wtConfig from '@hs-web-team/eslint-config-node'; export default [ ...wtConfig, ];
-
Extend the eslint on a project basis by adding rules to
eslint.config.jse.g.import wtConfig from '@hs-web-team/eslint-config-node'; export default [ // Add project-specific ignores here { ignores: ['dist/**'], }, // Add project-specific rules here { rules: { 'no-console': 'error', }, }, ...wtConfig, // This will include the shared rules from @hs-web-team/eslint-config-node ];
-
Install as dev dependency
npm i -D @hs-web-team/eslint-config-node@latest
-
Add to
eslint.config.jsin project root directoryimport wtBrowserConfig from '@hs-web-team/eslint-config-node/browser'; export default [ ...wtBrowserConfig, ];
-
The browser configuration includes:
- ESLint recommended rules for JavaScript
- TypeScript support with typescript-eslint
- React support with eslint-plugin-react
- React Hooks rules with eslint-plugin-react-hooks
- Accessibility rules with eslint-plugin-jsx-a11y
- Browser globals (window, document, etc.) and custom globals (jQuery, $, Invoca)
For detailed browser configuration documentation and migration guides, see examples/browser-usage.md.
This package provides two configurations:
- Node.js configuration (default export): For backend Node.js projects
- Browser configuration (
/browserexport): For browser-based projects including React applications
Choose the appropriate configuration based on your project type.
This package includes a utility script to automatically add Prettier configuration to your project.
-
Run the script:
node ./node_modules/@hs-web-team/eslint-config-node/bin/add-prettier-scripts.js
-
The script will:
- Add
prettier:checkandprettier:writescripts to your package.json - Install Prettier as a dev dependency if not already installed
- Create a
.prettierrc.jsfile with shared config - Create a
.prettierignorefile with sensible defaults
- Add
-
After installation, you can use the following commands:
npm run prettier:check- Check files for formatting issuesnpm run prettier:write- Automatically fix formatting issues
See MIGRATION-V2.md
See MIGRATION-V3.md