More Related Content Similar to The Human Linter — Ilya Gelman (20) The Human Linter — Ilya Gelman2. Ilya Gelman
- Organizer of AngularJS-IL
- Organizer of ReactJS-Israel
- Passionate about design and UX
Sr. Developer & Consultant @ 500Tech
4. Had to deploy fast
Didn’t read the documentation
Hoped to refactor later
It wasn’t me
New technology
5. 'use strict';
const React = require('react');
const BaseMixin = require('mixins/base');
const ChildrenMixin = require('mixins/children');
const ComponentUtils = require('utils/component');
const Config = require('lib/config');
const Notification = require('components/notifications');
modure.exports = React.createClass({
displayName:'Form',
mixins:[BaseMixin,ChildrenMixin],
propTypes: {metadata: React.PropTypes.object.isRequired,
notifications: React.PropTypes.array
},
getChildContext(){ return { action: this._handleAction,
formId: this.props.id}},
⌥ ⌘ L
6. 'use strict';
const React = require('react');
const BaseMixin = require('mixins/base');
const ChildrenMixin = require('mixins/children');
const ComponentUtils = require('utils/component');
const Config = require('lib/config');
const Notification = require('components/notifications');
modure.exports = React.createClass({
displayName: 'Form',
mixins: [BaseMixin, ChildrenMixin],
propTypes: {
metadata: React.PropTypes.object.isRequired,
notifications: React.PropTypes.array
},
getChildContext() {
return {
action: this._handleAction,
formId: this.props.id
}
}
13. ?
let point = {};
point.x = 10;
point.y = 29;
const point = {
x: 10,
y: 29
};
14. ?
while (processing) {
const config = {
option1: 123,
option2: 456
};
// ...
}
const config = {
option1: 123,
option2: 456
};
while (processing) {
// ...
}
22. function perimeter(options = {}) {
const opt = options;
return Math.sum(opt.top, opt.right, opt.bottom, opt.left);
}
perimeter({ top: 20, bottom: 23, left: 12, right: 15 });
ES6
* Not the best code, only shows options hash example
23. function perimeter(top, right, bottom, left) {
return Math.sum(top, right, bottom, left);
}
perimeter(/* top */ 20, /* right */ 15, /* bottom */ 23, /* left */ 12);
ES6
34. ESLint
https://github.com/500tech/code-style
.eslintrc
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": false,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"restParams": true,
"spread": true,
"superInFunctions": true,
"templateStrings": true,
"jsx": true,
"regexYFlag": true,
"regexUFlag": true,
},
"rules": {
// Disabled rules
"complexity": 0,
"no-extend-native": 0,
"no-process-env": 0,
"init-declarations": 0,
"no-restricted-modules": 0,
"no-sync": 0,
"no-undef-init": 0,
"linebreak-style": 0,
"no-inline-comments": 0,
"no-new-object": 0,
"no-ternary": 0,
"padded-blocks": 0,
"no-inner-declarations": 0,
"id-length": 0,
"id-match": 0,
"no-underscore-dangle": 0,
"sort-vars": 0,
"max-statements": 0,
// Warning level
"comma-dangle": [1, "always-multiline"],
"no-console": 1,
"no-control-regex": 1,
"no-empty": 1,
"no-func-assign": 1,
"consistent-return": 1,
"curly": [1, "all"],
"default-case": 1,
"dot-notation": 1,
"no-alert": 1,
"no-multi-spaces": 1,
"no-param-reassign": 1,
"no-warning-comments": [1, { "terms": ["todo",
"radix": 1,
"no-path-concat": 1,
"no-process-exit": 1,
"lines-around-comment": [1, { "beforeBlockComment":
"constructor-super": 1,
"prefer-template": 1,