Enable a lot of eslint options and plugins
Taken rules from Cockpit, which have been proven to be effective for finding bugs and keeping clean code, and sensible (not taking unreasonable effort to satisfy). Fix code layout in app.jsx accordingly. Closes #39
This commit is contained in:
parent
3922333029
commit
133badfa3d
3 changed files with 46 additions and 9 deletions
|
|
@ -3,7 +3,8 @@
|
|||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"extends": ["eslint:recommended", "standard", "standard-react"],
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"experimentalObjectRestSpread": true,
|
||||
|
|
@ -11,11 +12,38 @@
|
|||
},
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["react"],
|
||||
"plugins": ["flowtype", "react"],
|
||||
"rules": {
|
||||
"react/jsx-uses-vars": "error",
|
||||
"indent": ["error", 4,
|
||||
{
|
||||
"ObjectExpression": "first",
|
||||
"CallExpression": {"arguments": "first"},
|
||||
"MemberExpression": 2,
|
||||
"ignoredNodes": [ "JSXAttribute" ]
|
||||
}],
|
||||
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 }],
|
||||
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
|
||||
"prefer-promise-reject-errors": ["error", { "allowEmptyReject": true }],
|
||||
"react/jsx-indent": ["error", 4],
|
||||
"semi": ["error", "always", { "omitLastInOneLineBlock": true }],
|
||||
|
||||
"camelcase": "off",
|
||||
"comma-dangle": "off",
|
||||
"curly": "off",
|
||||
"jsx-quotes": "off",
|
||||
"key-spacing": "off",
|
||||
"no-console": "off",
|
||||
"no-undef": "error"
|
||||
"quotes": "off",
|
||||
"react/jsx-curly-spacing": "off",
|
||||
"react/jsx-indent-props": "off",
|
||||
"react/prop-types": "off",
|
||||
"space-before-function-paren": "off",
|
||||
"standard/no-callback-literal": "off",
|
||||
|
||||
"eqeqeq": "off",
|
||||
"import/no-webpack-loader-syntax": "off",
|
||||
"object-property-newline": "off",
|
||||
"react/jsx-no-bind": "off"
|
||||
},
|
||||
"globals": {
|
||||
"require": false,
|
||||
|
|
|
|||
12
package.json
12
package.json
|
|
@ -11,6 +11,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.25.0",
|
||||
"babel-eslint": "^9.0.0",
|
||||
"babel-loader": "^7.0.0",
|
||||
"babel-plugin-transform-react-jsx": "^6.24.1",
|
||||
"babel-preset-env": "^1.5.2",
|
||||
|
|
@ -18,9 +19,16 @@
|
|||
"compression-webpack-plugin": "~1.0.0",
|
||||
"copy-webpack-plugin": "~3.0.1",
|
||||
"css-loader": "^0.28.11",
|
||||
"eslint": "^3.0.0",
|
||||
"eslint": "^5.4.0",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-config-standard-react": "^6.0.0",
|
||||
"eslint-loader": "~1.6.1",
|
||||
"eslint-plugin-react": "~6.9.0",
|
||||
"eslint-plugin-flowtype": "^2.50.0",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-node": "^7.0.1",
|
||||
"eslint-plugin-promise": "^4.0.0",
|
||||
"eslint-plugin-react": "^6.9.0",
|
||||
"eslint-plugin-standard": "^3.1.0",
|
||||
"extract-text-webpack-plugin": "^2.1.0",
|
||||
"htmlparser": "^1.7.7",
|
||||
"jed": "^1.1.1",
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@ export class Application extends React.Component {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
cockpit.file('/etc/hostname').read().done((content) => {
|
||||
this.setState({ 'hostname': content.trim() });
|
||||
});
|
||||
cockpit.file('/etc/hostname').read()
|
||||
.done((content) => {
|
||||
this.setState({ 'hostname': content.trim() });
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue