Skip to content

Instantly share code, notes, and snippets.

@danielres
Last active June 8, 2020 06:53
Show Gist options
  • Save danielres/8f80560404d6042027f189863ef1e161 to your computer and use it in GitHub Desktop.
Save danielres/8f80560404d6042027f189863ef1e161 to your computer and use it in GitHub Desktop.
nextjs typescript config
node_modules
dist
coverage
.eslintrc.js
module.exports = {
root: true,
parser: "@typescript-eslint/parser", // the TypeScript parser we installed earlier
parserOptions: {
ecmaFeatures: { jsx: true }, // Allows for the parsing of JSX
},
extends: [
"eslint:recommended", // eslint default rules
"plugin:@typescript-eslint/eslint-recommended", // eslint TypeScript rules (github.com/typescript-eslint/typescript-eslint)
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended", // eslint react rules (github.com/yannickcr/eslint-plugin-react)
"plugin:jsx-a11y/recommended", // accessibility plugin
],
rules: {
"react/prop-types": "off", // We turn off prop-types rule, as we will use TypeScript's types instead.
"jsx-a11y/anchor-is-valid": "off",
},
};
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "9.3.5",
"react": "16.13.1",
"react-dom": "16.13.1"
},
"devDependencies": {
"@types/node": "^14.0.11",
"@types/react": "^16.9.35",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"eslint": "^7.2.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4",
"typescript": "^3.9.5"
}
}
{
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment