Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ESLint + TSLint + TypeScript + Create React App TS
- ## .eslintrc
- ```json
- {
- "parser": "typescript-eslint-parser",
- "extends": [
- "airbnb",
- "prettier",
- "prettier/react",
- "plugin:prettier/recommended",
- "plugin:jest/recommended",
- "plugin:unicorn/recommended"
- ],
- "plugins": ["prettier", "jest", "unicorn"],
- "parserOptions": {
- "sourceType": "module",
- "ecmaFeatures": {
- "jsx": true
- }
- },
- "env": {
- "es6": true,
- "browser": true,
- "jest": true
- },
- "rules": {
- "prettier/prettier": [
- "error",
- {
- "singleQuote": true,
- "trailingComma": "all"
- }
- ],
- "jsx-a11y/anchor-is-valid": [
- "error",
- {
- "components": ["Link"],
- "specialLink": ["to"],
- "aspects": ["noHref", "invalidHref", "preferButton"]
- }
- ],
- "react/jsx-filename-extension": "off",
- "unicorn/filename-case": "off",
- "import/extensions": { "ts": "never", "tsx": "never" },
- "no-use-before-define": "warn",
- "no-param-reassign": "warn"
- },
- "settings": {
- "import/resolver": {
- "node": {
- "extensions": [".ts", ".tsx"]
- }
- }
- },
- "overrides": [
- {
- "files": ["**/*.ts", "**/*.tsx"],
- "parser": "typescript-eslint-parser",
- "rules": {
- "no-undef": "off"
- }
- }
- ]
- }
- ```
- ## tslint.json
- ```json
- {
- "extends": [
- "tslint:recommended",
- "tslint-config-airbnb",
- "tslint-react",
- "tslint-config-prettier"
- ],
- "linterOptions": {
- "exclude": ["config/**/*.js", "node_modules/**/*.ts"]
- }
- }
- ```
- ## .prettierrc
- ```json
- {
- "printWidth": 89,
- "tabWidth": 2,
- "useTabs": false,
- "semi": true,
- "singleQuote": true,
- "trailingComma": "all",
- "bracketSpacing": true,
- "jsxBracketSameLine": false
- }
- ```
- ## package.json
- ```json
- {
- "name": "eslint-typescript",
- "version": "0.1.0",
- "private": true,
- "dependencies": {
- "react": "^16.3.2",
- "react-dom": "^16.3.2",
- "react-scripts-ts": "2.16.0"
- },
- "scripts": {
- "start": "react-scripts-ts start",
- "build": "react-scripts-ts build",
- "test": "react-scripts-ts test --env=jsdom",
- "eject": "react-scripts-ts eject"
- },
- "devDependencies": {
- "@types/jest": "^22.2.3",
- "@types/node": "^10.0.9",
- "@types/react": "^16.3.14",
- "@types/react-dom": "^16.0.5",
- "eslint": "^4.9.0",
- "eslint-config-airbnb": "16.1.0",
- "eslint-config-prettier": "^2.9.0",
- "eslint-plugin-import": "^2.7.0",
- "eslint-plugin-jest": "^21.15.1",
- "eslint-plugin-jsx-a11y": "^6.0.2",
- "eslint-plugin-prettier": "^2.6.0",
- "eslint-plugin-react": "^7.4.0",
- "eslint-plugin-unicorn": "^4.0.3",
- "prettier": "^1.12.1",
- "tslint-config-airbnb": "^5.8.0",
- "typescript": "^2.8.3",
- "typescript-eslint-parser": "^15.0.0"
- }
- }
- ```
Add Comment
Please, Sign In to add comment