Alexey Ulianov Optimax Ltd
Part 1. The problem
Part 2. Decision
> 9000 stars
Who use
and other company
['1','2','3'].map(parseInt)
['1','2','3'].map(parseInt)
[1, NaN, NaN]
['1','2','3'].map(parseInt)
[1, NaN, NaN]
parseInt('1', 0);
parseInt('2', 1);
parseInt('3', 2);
Possible Errors
Best Practices
Variables
Stylistic Issues
ECMAScript 6
Do not use the '===' operator to compare against -0.
if (x === -0) {
// doSomething();
}
Function 'a' has a complexity of 3.
/*eslint complexity: ["error", 2]*/
function a(x) {
if (true) {
return x;
} else if (false) {
return x+1;
} else {
return 4; // 3rd path
}
}
/*eslint no-unused-vars: "error"*/
/*global some_unused_var*/
some_unused_var = 42;
/*eslint no-mixed-spaces-and-tabs: "error"*/
function main() {
// --->var x = 5,
// --->....y = 7;
var x = 5,
y = 7;
}
Mixed spaces and tabs.
/*eslint no-const-assign: "error"*/
/*eslint-env es6*/
const a = 0;
a = 1;
'a' is constant.
> 4000 stars
by default: SCSS, Less and SugarSS
who use
and other company
Part 3. Install
npm install --save-dev eslint stylelint
yarn add eslint stylelint --dev
.stylelintrc
.eslintrc
{
"rules": {
"no-console": "error"
}
}
"scripts": {
"eslint": "npm run eslint",
"stylelint": "npm run stylelint"
}
yarn eslint --fix src/**/*.js
yarn stylelint --fix src/**/*.css