@hs-web-team/eslint-config-browser
v2.1.6
Published
HubSpot Marketing WebTeam ESLint rules for Browsers
Downloads
1,195
Maintainers
Keywords
Readme
Hubspot Marketing WebTeam ESLint rules for Browsers
This is a list of ESLint rules that are recommended for use with Hubspot Marketing WebTeam projects.
https://www.npmjs.com/package/@hs-web-team/eslint-config-browser
Index
Introduction
This is a set of ESLint rules that are recommended for use with Hubspot Marketing WebTeam projects, and it also include StyleLint as a linter for CSS/SCSS files.
Setup
- Install as dev dependency
npm i -D @hs-web-team/eslint-config-browser
- Add to
.eslintrc
in project root directory
{
"extends": "@hs-web-team/eslint-config-browser"
}
- Extend the eslint on a project basis by adding rules to
.eslintrc
e.g.
{
"extends": "@hs-web-team/eslint-config-browser",
"settings": {
"import/resolver": "webpack"
}
}
- Extend the style-lint rules on a project basis by adding a
.stylelintrc.json
:
{
"extends": "./node_modules/@hs-web-team/eslint-config-browser/.stylelintrc.json",
"ignoreFiles": [
// any folders to ignore
// e.g. "./dist/**/*.{css,scss,sass}"
]
}
- (Optional) Import cypress default configuration
// cypress.config.js
const { defineConfig } = require('cypress');
const { getDevBaseUrl, config, envs } = require('@hs-web-team/eslint-config-browser/cypress.config.js');
const devBaseUrl = getDevBaseUrl();
const baseUrls = {
[envs.DEV]: devBaseUrl,
[envs.QA]: '{{QA_URL}}',
[envs.PROD]: '{{PROD_URL}}',
};
const baseUrl = baseUrls[envs.currentEnv];
module.exports = defineConfig({
...config,
e2e: {
baseUrl,
},
});
Migrating from an existing .eslint config
- Remove
node_modules
- Delete
package-lock.json
npm i
- Re open your vscode/editor workspace
- Check if
js
linting andsass
linting works
Reference https://eslint.org/docs/developer-guide/shareable-configs
Where to use it
This package is intended to be used as a starting point for ESLint rules for FrontEnd projects, and should be used in browser environments.