DEPRECATED
This eslint config was used for old JavaScript based MaaS Global projects. The focus of development has since moved to TypeScript. The config available in this package has been deprecated as a result. Please migrate to eslint-config-maasglobal-ts that is used for all new MaaS Global projects.
In package.json
reference eslint-config-maasglobal
, eslint-plugin-import
, eslint-plugin-jsdoc
as one of devDependencies
, and configure eslint as:
{
"eslintConfig": {
"extends": "maasglobal"
}
}
Note that provided eslint setup doesn't handle eventual code style formatting. This is supposed to be solely guarded by Prettier
Within new projects, ensure prettier
as one of devDependencies
and setup .prettierrc.js
as:
'use strict';
module.exports = require('eslint-config-maasglobal/.prettierrc');
It's highly recommended that for consistent whitespace formatting, an IDE is configured to also apply Prettier formatting on each file save.
For proper CI integration it's recommended that all MaaS projects have following scripts preconfgured:
{
"lint": "eslint --ignore-path=.gitignore .",
"lint-updated": "pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'",
"prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
"prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'",
"prettify-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write"
}
Note: Scripts require additional git-list-updated
dependency to be installed, reference it in devDependencies
In Travis CI configuration, ensure that following validation is made on each PR build (but not on branch deployment):
npm run lint-updated && npm run prettier-check-updated