Add ESLint to maintain code style. Add pre-commit hook to lint prior.

ESLint is used with the standard react plugin. It detects all kinds of
issues ranging from misspells, indentation, variable-naming, etc.
A pre-commit hook is added to git. Prior commiting, ESlint will run
to validate that everything is OK and the user will have the option
to fix it.

Signed-off-by: Sudhanshu Gautam <me@sudhanshug.com>
This commit is contained in:
Sudhanshu Gautam 2019-07-21 21:27:38 +05:30
parent d30cf925b1
commit 9475f4092a
13 changed files with 1116 additions and 1036 deletions

View file

@ -39,46 +39,46 @@ export default function Header() {
const id = open ? 'simple-popper' : undefined;
return (
<AppBar position="static">
<Toolbar>
<Typography edge="start" variant="h6">{t(
'OpenWrt Firmware Selector Wizard')}</Typography>
<div style={{flexGrow: 1}} />
<Button aria-describedby={id} color="secondary" variant="contained"
onClick={openChangeLanguagePopper} href="#">
{t('Change Language')} &nbsp;
<LanguageIcon/>
</Button>
<Popper
id={id}
open={open}
anchorEl={anchorEl}
transition
disablePortal={true}
>
{({TransitionProps}) => (
<Fade {...TransitionProps} timeout={350}>
<Paper className="language-selector-popper">
<FormControl component="fieldset">
<FormLabel component="legend">Change Language</FormLabel>
<br/>
<RadioGroup
aria-label="Language"
name="language"
value={value}
onChange={changeLanguage}
>
<FormControlLabel value="en" control={<Radio/>}
label={t('English')}/>
<FormControlLabel value="de" control={<Radio/>}
label={t('German')}/>
</RadioGroup>
</FormControl>
</Paper>
</Fade>
)}
</Popper>
</Toolbar>
</AppBar>
<AppBar position="static">
<Toolbar>
<Typography edge="start" variant="h6">{t(
'OpenWrt Firmware Selector Wizard')}</Typography>
<div style={{flexGrow: 1}} />
<Button aria-describedby={id} color="secondary" variant="contained"
onClick={openChangeLanguagePopper} href="#">
{t('Change Language')} &nbsp;
<LanguageIcon/>
</Button>
<Popper
id={id}
open={open}
anchorEl={anchorEl}
transition
disablePortal={true}
>
{({TransitionProps}) => (
<Fade {...TransitionProps} timeout={350}>
<Paper className="language-selector-popper">
<FormControl component="fieldset">
<FormLabel component="legend">Change Language</FormLabel>
<br/>
<RadioGroup
aria-label="Language"
name="language"
value={value}
onChange={changeLanguage}
>
<FormControlLabel value="en" control={<Radio/>}
label={t('English')}/>
<FormControlLabel value="de" control={<Radio/>}
label={t('German')}/>
</RadioGroup>
</FormControl>
</Paper>
</Fade>
)}
</Popper>
</Toolbar>
</AppBar>
);
}