Linting rules
This commit is contained in:
parent
f322e539d2
commit
3dc7845303
63
.eslintrc
63
.eslintrc
@ -10,6 +10,7 @@
|
||||
"plugin:inferno/recommended",
|
||||
"eslint-config-happiness"
|
||||
],
|
||||
"globals": {},
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
@ -19,11 +20,63 @@
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"import/extensions": 0,
|
||||
"import/no-extraneous-dependencies": 0,
|
||||
"array-callback-return": "error",
|
||||
"camelcase": ["error", {
|
||||
"properties": "never"
|
||||
}],
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"import/extensions": "off",
|
||||
"import/no-extraneous-dependencies": "off",
|
||||
"import/no-unresolved": [2, { "ignore": ["electron"] }],
|
||||
"linebreak-style": 0,
|
||||
"react/prefer-stateless-function": 0,
|
||||
"no-console": 0
|
||||
"jsx-quotes": ["error", "prefer-double"],
|
||||
"linebreak-style": "off",
|
||||
"multiline-ternary": ["error", "always-multiline"],
|
||||
"prefer-arrow-callback": ["error", {
|
||||
"allowNamedFunctions": true
|
||||
}],
|
||||
"prefer-const": "error",
|
||||
"no-alert": "error",
|
||||
"no-console": "off",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-eval": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-semi": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-invalid-this": "error",
|
||||
"no-nested-ternary": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-return-await": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-shadow": ["error", {
|
||||
"builtinGlobals": true
|
||||
}],
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-use-before-define": "error",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-concat": "error",
|
||||
"no-useless-return": "error",
|
||||
"no-var": "error",
|
||||
"no-with": "error",
|
||||
"prefer-rest-params": "error",
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "error",
|
||||
"quotes": ["error", "single", {
|
||||
"allowTemplateLiterals": true,
|
||||
"avoidEscape": true
|
||||
}],
|
||||
"quote-props": ["error", "as-needed", {
|
||||
"keywords": true,
|
||||
"unnecessary": false,
|
||||
"numbers": false
|
||||
}],
|
||||
"radix": ["error", "always"],
|
||||
"react/prefer-stateless-function": "off",
|
||||
"require-await": "error",
|
||||
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": true}],
|
||||
"yoda": ["error", "never"]
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ You can find the most recent version of this guide [here](https://github.com/fac
|
||||
- [npm test](#npm-test)
|
||||
- [npm run build](#npm-run-build)
|
||||
- [npm run eject](#npm-run-eject)
|
||||
- [Supported Browsers](#supported-browsers)
|
||||
- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills)
|
||||
- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor)
|
||||
- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)
|
||||
@ -198,12 +197,6 @@ Instead, it will copy all the configuration files and the transitive dependencie
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Supported Browsers
|
||||
|
||||
By default, the generated project uses the latest version of React.
|
||||
|
||||
You can refer [to the React documentation](https://reactjs.org/docs/react-dom.html#browser-support) for more information about supported browsers.
|
||||
|
||||
## Supported Language Features and Polyfills
|
||||
|
||||
This project supports a superset of the latest JavaScript standard.<br>
|
||||
|
16
src/App.js
16
src/App.js
@ -1,5 +1,6 @@
|
||||
import { version } from 'inferno';
|
||||
import { BrowserRouter, Route } from 'inferno-router'
|
||||
import { BrowserRouter } from 'inferno-router';
|
||||
|
||||
import { Button, Form, FormGroup, Input, Label } from './components/Form';
|
||||
import { Container, Row } from './components/Grid';
|
||||
|
||||
const App = () => (
|
||||
@ -7,7 +8,7 @@ const App = () => (
|
||||
<Container className="App">
|
||||
<Row>
|
||||
<header className="App-header">
|
||||
<h1>{`Welcome to Inferno ${version}`}</h1>
|
||||
<h1>Welcome to Inferno</h1>
|
||||
</header>
|
||||
</Row>
|
||||
<Row>
|
||||
@ -15,6 +16,15 @@ const App = () => (
|
||||
To get started, edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
</Row>
|
||||
<Row>
|
||||
<Form>
|
||||
<FormGroup>
|
||||
<Label htmlFor="brand">Brand</Label>
|
||||
<Input type="text" id="brand" name="brand" />
|
||||
</FormGroup>
|
||||
<Button type="submit">Save</Button>
|
||||
</Form>
|
||||
</Row>
|
||||
</Container>
|
||||
</BrowserRouter>
|
||||
);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { render } from 'inferno';
|
||||
import App from './App';
|
||||
import { render } from 'inferno';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
|
25
src/components/Form.js
Normal file
25
src/components/Form.js
Normal file
@ -0,0 +1,25 @@
|
||||
import Button from 'inferno-bootstrap/dist/Button';
|
||||
import Form from 'inferno-bootstrap/dist/Form/Form';
|
||||
import FormFeedback from 'inferno-bootstrap/dist/Form/FormFeedback';
|
||||
import FormGroup from 'inferno-bootstrap/dist/Form/FormGroup';
|
||||
import FormText from 'inferno-bootstrap/dist/Form/FormText';
|
||||
import Input from 'inferno-bootstrap/dist/Form/Input';
|
||||
import InputGroup from 'inferno-bootstrap/dist/Form/InputGroup';
|
||||
import InputGroupAddon from 'inferno-bootstrap/dist/Form/InputGroupAddon';
|
||||
import InputGroupButtonDropdown from 'inferno-bootstrap/dist/Form/InputGroupButtonDropdown';
|
||||
import InputGroupText from 'inferno-bootstrap/dist/Form/InputGroupText';
|
||||
import Label from 'inferno-bootstrap/dist/Form/Label';
|
||||
|
||||
export {
|
||||
Button,
|
||||
Form,
|
||||
FormFeedback,
|
||||
FormGroup,
|
||||
FormText,
|
||||
Input,
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupButtonDropdown,
|
||||
InputGroupText,
|
||||
Label,
|
||||
};
|
@ -1,9 +1,9 @@
|
||||
import Container from 'inferno-bootstrap/dist/Container'
|
||||
import Row from 'inferno-bootstrap/dist/Row'
|
||||
import Col from 'inferno-bootstrap/dist/Col'
|
||||
import Col from 'inferno-bootstrap/dist/Col';
|
||||
import Container from 'inferno-bootstrap/dist/Container';
|
||||
import Row from 'inferno-bootstrap/dist/Row';
|
||||
|
||||
export {
|
||||
Col,
|
||||
Container,
|
||||
Row,
|
||||
}
|
||||
};
|
||||
|
@ -1 +1 @@
|
||||
export * from './Grid'
|
||||
export * from './Grid';
|
||||
|
@ -11,18 +11,18 @@ const url = require('url');
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow;
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', () => {
|
||||
const createWindow = () => {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({width: 800, height: 600});
|
||||
mainWindow = new BrowserWindow({
|
||||
height: 600,
|
||||
width: 800,
|
||||
});
|
||||
|
||||
// load the index.html of the app.
|
||||
const startUrl = process.env.ELECTRON_START_URL || url.format({
|
||||
pathname: path.join(__dirname, '/../../build/index.html'),
|
||||
protocol: 'file:',
|
||||
slashes: true
|
||||
slashes: true,
|
||||
});
|
||||
mainWindow.loadURL(startUrl);
|
||||
// Open the DevTools.
|
||||
@ -35,7 +35,12 @@ app.on('ready', () => {
|
||||
// when you should delete the corresponding element.
|
||||
mainWindow = null;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', createWindow);
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { render } from 'inferno';
|
||||
import App from './App';
|
||||
import { render } from 'inferno';
|
||||
|
||||
render(<App />, document.getElementById('app'));
|
||||
|
@ -1,3 +1,3 @@
|
||||
export const CameraList = () => {
|
||||
return <div />
|
||||
}
|
||||
return <div />;
|
||||
};
|
||||
|
@ -1 +1 @@
|
||||
export * from './CameraList'
|
||||
export * from './Camera';
|
||||
|
Loading…
Reference in New Issue
Block a user