@adbros/fe-coding-standard
v1.0.2
Published
## Installation
Downloads
7
Readme
Adbros Frontend Coding Standard
Installation
npm i git+https://gitlab.adbros.com/adb/fe-coding-standard#semver:^1.0.2 --save-dev
Vue.js
You can add FE coding standard to any Vue CLI project using Vue CLI plugin FE coding standard
.
Update
npm update fe-coding-standard
Configuration
Create eslint.json
or extend eslintrc.js
in root directory of your project.
{
"extends": ["./node_modules/fe-coding-standard/eslint-default.json"]
}
Create stylelint.json
or extend stylelintrc.js
in root directory of your project.
{
"extends": ["./node_modules/fe-coding-standard/stylelint-default.json"]
}
Usage
npm usage
Update package.json
in your project.
{
"scripts": {
"eslint": "eslint -c eslint.json js/edit/*.js",
"stylelint": "stylelint --config stylelint.json --syntax scss css/edit/*.scss"
}
}
To test your code against coding standard run
npm run-script eslint
npm run-script stylelint
grunt usage
Install grunt dependencies
npm i grunt-eslint --save-dev
npm i grunt-stylelint --save-dev
Update gruntfile.js
in your project.
grunt.initConfig({
eslint: {
options: {
configFile: 'eslint.json',
fix: grunt.option('fix')
},
target: ['js/src/*.js']
},
stylelint: {
options: {
configFile: 'css/stylelint.json',
syntax: 'scss',
fix: grunt.option('fix')
},
src: [ 'css/src/*.scss' ]
}
});
To test your code against coding standard run
grunt eslint
grunt stylelint
You can automatically fix certain linting errors by running grunt
commands with --fix
option
More information
For more information about ESLint configuration visit readme-eslint.md
.
For more information about stylelint configuration visit readme-stylelint.md
.