Skip to content

Instantly share code, notes, and snippets.

@pocojang
Forked from RyanHirsch/.eslintignore
Created October 27, 2020 06:31
Show Gist options
  • Save pocojang/a500bbe00f6d70f460e46d0c685792c0 to your computer and use it in GitHub Desktop.
Save pocojang/a500bbe00f6d70f460e46d0c685792c0 to your computer and use it in GitHub Desktop.
Typescript + Jest + ESLint + Tailwind
.next
__generated__
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
],
"@typescript-eslint/no-use-before-define": "off",
"react/react-in-jsx-scope": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}
.next
__generated__
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
yarn add tailwindcss postcss-import autoprefixer @fullhuman/postcss-purgecss
yarn add -D \
eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react \
prettier eslint-config-prettier eslint-plugin-prettier \
jest @testing-library/jest-dom @testing-library/react ts-jest \
lint-staged husky npm-run-all
/* eslint-env node */
module.exports = {
preset: "ts-jest/presets/js-with-ts",
moduleFileExtensions: ["ts", "tsx", "js"],
moduleNameMapper: {},
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
testMatch: ["**/__tests__/*.(ts|tsx)"],
setupFilesAfterEnv: ["./jest.setup.ts"],
testPathIgnorePatterns: ["./.next/", "./node_modules/"],
globals: {
"ts-jest": {
tsConfig: "tsconfig.jest.json",
},
},
};
import "@testing-library/jest-dom";
{
"scripts": {
"lint": "yarn codegen && npm-run-all -p lint:*",
"lint:tsc": "tsc --noEmit",
"lint:eslint": "eslint --ext .js,.ts,.tsx .",
"lint:prettier": "prettier --check .",
"fix": "prettier --write . && eslint --fix --ext .js,.ts,.tsx .",
"test": "jest"
},
"lint-staged": {
"*.{js,ts,tsx}": [
"prettier --write",
"eslint --ext .js,.ts,.tsx --fix"
]
},
"husky": {
"hooks": {
"pre-commit": "tsc --noEmit && lint-staged && yarn test"
}
}
}
import { NextPage } from "next";
import "../css/tailwind.css";
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const App = ({
Component,
pageProps,
}: {
Component: NextPage;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
pageProps: any;
}) => {
return <Component {...pageProps} />;
};
export default App;
/* eslint-env node */
const purgecss = [
"@fullhuman/postcss-purgecss",
{
content: ["./components/**/*.js", "./pages/**/*.js"],
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [],
},
];
module.exports = {
plugins: [
"postcss-import",
"tailwindcss",
"autoprefixer",
...(process.env.NODE_ENV === "production" ? [purgecss] : []),
],
};
/* eslint-env node */
module.exports = {
theme: {
extend: {},
},
variants: {
backgroundColor: ["responsive", "hover", "focus", "active"],
},
plugins: [],
};
{
"extends": "./tsconfig.json",
"include": [
"**/*.tsx",
"**/*.ts",
"*.ts",
"**/*.js",
"*.js",
"next-env.d.ts"
],
"exclude": ["node_modules", "dist", ".next", "out"]
}
{
"compilerOptions": {
"jsx": "react",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noImplicitAny": true,
"sourceMap": true,
"target": "es5"
},
"include": ["**/*.ts", "**/*.tsx"]
}
{
"compilerOptions": {
"allowJs": true,
"alwaysStrict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment