Added ESLint support

This commit is contained in:
Dustin Brett 2021-01-02 23:30:32 -08:00
parent 1d9460eaf9
commit d24a099d12
7 changed files with 1845 additions and 8 deletions

41
.eslintrc.json Normal file
View File

@ -0,0 +1,41 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"airbnb",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
],
"globals": {
"React": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"comma-dangle": "off",
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }],
"react/jsx-props-no-spreading": "off"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {}
}
}
}

4
next-env.d.ts vendored
View File

@ -1,2 +1,2 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/types/global" /> /// <reference types="next/types/global" />

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
reactStrictMode: true reactStrictMode: true
}; };

1783
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"eslint": "eslint .",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"repository": { "repository": {
@ -23,6 +24,15 @@
"devDependencies": { "devDependencies": {
"@types/node": "^14.14.19", "@types/node": "^14.14.19",
"@types/react": "^17.0.0", "@types/react": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.11.1",
"@typescript-eslint/parser": "^4.11.1",
"eslint": "^7.17.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"typescript": "^4.1.3" "typescript": "^4.1.3"
} }
} }

View File

@ -1,7 +1,8 @@
import 'styles/globals.scss'; import 'styles/globals.scss';
import type { AppProps } from 'next/app'; import type { AppProps } from 'next/app';
import type { ReactElement } from 'react';
export default function MyApp({ Component, pageProps }: AppProps) { export default function MyApp({ Component, pageProps }: AppProps): ReactElement {
return <Component {...pageProps} />; return <Component {...pageProps} />;
}; }

View File

@ -1,3 +1,5 @@
export default function Home() { import type { ReactElement } from 'react';
export default function Home(): ReactElement {
return <h1>Hello, world!</h1>; return <h1>Hello, world!</h1>;
} }