├── .vscode └── settings.json ├── tests ├── .eslintrc └── tslint.ts ├── eslint-prettier.js ├── tslint-react.json ├── eslint.js ├── .gitignore ├── LICENSE ├── package.json ├── tsconfig.json ├── tslint.json ├── CODE_OF_CONDUCT.md └── README.md /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.enable": true 3 | } -------------------------------------------------------------------------------- /tests/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../eslint.js"] 3 | } 4 | -------------------------------------------------------------------------------- /tests/tslint.ts: -------------------------------------------------------------------------------- 1 | //Should underline this comment 2 | var i = 1; // should underline var 3 | -------------------------------------------------------------------------------- /eslint-prettier.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['prettier', 'prettier/@typescript-eslint'], 3 | }; 4 | -------------------------------------------------------------------------------- /tslint-react.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint-react"], 3 | "rules": { 4 | "jsx-no-multiline-js": false, 5 | "jsx-no-lambda": false 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /eslint.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | parserOptions: { 4 | project: './tsconfig.json', 5 | tsconfigRootDir: '.', 6 | }, 7 | plugins: ['@typescript-eslint'], 8 | extends: ['plugin:@typescript-eslint/recommended'], 9 | rules: { 10 | '@typescript-eslint/explicit-function-return-type': 'off', 11 | '@typescript-eslint/no-explicit-any': 'off', 12 | '@typescript-eslint/no-unused-vars': 'off', 13 | }, 14 | overrides: [ 15 | { 16 | // Disable some rules in unit tests. 17 | files: ['test/**/*.ts', 'test/**/*.tsx', '**/*.spec.ts', '**/*.spec.tsx'], 18 | rules: { 19 | '@typescript-eslint/no-non-null-assertion': 'off', 20 | '@typescript-eslint/no-object-literal-type-assertion': 'off', 21 | }, 22 | }, 23 | ], 24 | }; 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Piotr Witek (http://piotrwitek.github.io/) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-redux-typescript-scripts", 3 | "version": "1.6.2", 4 | "description": "Shared dev-tools configuration files based on \"react-redux-typescript-guide\"", 5 | "main": "index.js", 6 | "scripts": { 7 | "doctoc": "doctoc .", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/piotrwitek/react-redux-typescript-scripts.git" 13 | }, 14 | "keywords": [ 15 | "react-redux-typescript-guide", 16 | "configuration", 17 | "scripts", 18 | "tslint", 19 | "tsconfig" 20 | ], 21 | "author": "Piotr Witek (http://piotrwitek.github.io/)", 22 | "license": "MIT", 23 | "bugs": { 24 | "url": "https://github.com/piotrwitek/react-redux-typescript-scripts/issues" 25 | }, 26 | "homepage": "https://github.com/piotrwitek/react-redux-typescript-scripts#readme", 27 | "dependencies": {}, 28 | "peerDependencies": { 29 | "typescript": "^3.0.0" 30 | }, 31 | "devDependencies": { 32 | "@typescript-eslint/eslint-plugin": "1.7.0", 33 | "eslint-config-prettier": "4.2.0", 34 | "doctoc": "1.4.0", 35 | "eslint": "5.16.0", 36 | "prettier": "1.17.0", 37 | "tslint": "5.16.0", 38 | "tslint-react": "4.0.0", 39 | "typescript": "3.4.5" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", // relative paths base 4 | // "paths": { 5 | // "@src/*": ["src/*"], // will enable import aliases -> import { ... } from '@src/components' 6 | // //WARNING: Require to add this to your webpack config -> resolve: { alias: { '@src': PATH_TO_SRC } } 7 | // "redux": ["typings/redux"], // override library types with your alternative type-definitions in typings folder 8 | // "redux-thunk": ["typings/redux-thunk"] // override library types with your alternative type-definitions in typings folder 9 | // }, 10 | "outDir": "dist/", // target for compiled files 11 | "allowSyntheticDefaultImports": true, // no errors with commonjs modules interop 12 | "esModuleInterop": true, // enable to do "import React ..." instead of "import * as React ..." 13 | "allowJs": true, // include js files 14 | "checkJs": false, // typecheck js files 15 | "declaration": false, // don't emit declarations 16 | "emitDecoratorMetadata": true, // include only if using decorators 17 | "experimentalDecorators": true, // include only if using decorators 18 | "forceConsistentCasingInFileNames": true, 19 | "importHelpers": true, // importing transpilation helpers from tslib 20 | "noEmitHelpers": true, // disable inline transpilation helpers in each file 21 | "jsx": "preserve", // preserving JSX 22 | "lib": ["dom", "es2017"], // you will need to include polyfills for es2017 manually 23 | "skipLibCheck": true, 24 | "types": ["jest"], // which global types to use 25 | "target": "es5", // "es2015" for ES6+ engines 26 | "module": "esnext", // "es2015" for tree-shaking 27 | "moduleResolution": "node", 28 | "resolveJsonModule": true, 29 | "isolatedModules": true, 30 | "noEmit": true, 31 | "noEmitOnError": false, 32 | "noFallthroughCasesInSwitch": true, 33 | "noUnusedLocals": true, 34 | "strict": true, 35 | "pretty": true, 36 | "removeComments": true, 37 | "sourceMap": true 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint:recommended"], 3 | "rules": { 4 | "arrow-parens": false, 5 | "arrow-return-shorthand": [false], 6 | "comment-format": [true, "check-space"], 7 | "import-blacklist": [true], 8 | "interface-over-type-literal": false, 9 | "interface-name": false, 10 | "max-line-length": [true, 120], 11 | "member-access": false, 12 | "member-ordering": [true, { "order": "fields-first" }], 13 | "newline-before-return": false, 14 | "no-any": false, 15 | "no-empty-interface": false, 16 | "no-import-side-effect": [true], 17 | "no-inferrable-types": [true, "ignore-params", "ignore-properties"], 18 | "no-invalid-this": [true, "check-function-in-method"], 19 | "no-namespace": false, 20 | "no-null-keyword": false, 21 | "no-require-imports": false, 22 | "no-submodule-imports": [true, "@src", "rxjs"], 23 | "no-this-assignment": [true, { "allow-destructuring": true }], 24 | "no-trailing-whitespace": true, 25 | "object-literal-sort-keys": false, 26 | "object-literal-shorthand": false, 27 | "one-variable-per-declaration": [false], 28 | "only-arrow-functions": [true, "allow-declarations"], 29 | "ordered-imports": [false], 30 | "prefer-method-signature": false, 31 | "prefer-template": [true, "allow-single-concat"], 32 | "quotemark": [true, "single", "jsx-double"], 33 | "semicolon": [true, "always", "ignore-bound-class-methods"], 34 | "trailing-comma": [ 35 | true, 36 | { 37 | "singleline": "never", 38 | "multiline": { 39 | "objects": "always", 40 | "arrays": "always", 41 | "functions": "ignore", 42 | "typeLiterals": "ignore" 43 | }, 44 | "esSpecCompliant": true 45 | } 46 | ], 47 | "triple-equals": [true, "allow-null-check"], 48 | "type-literal-delimiter": true, 49 | "typedef": [true, "parameter", "property-declaration"], 50 | "variable-name": [ 51 | true, 52 | "ban-keywords", 53 | "check-format", 54 | "allow-pascal-case", 55 | "allow-leading-underscore" 56 | ] 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at piotrek.witek@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

react-redux-typescript-scripts 🛠

3 | 4 |

Shared dev-tools configuration files based on react-redux-typescript-guide

5 |
6 | 7 | --- 8 | 9 | > For now you can find `eslint`, `tslint` and `tsconfig` configurations, but I'm willing to add more tools and scripts in the future e.g. `jest`, `babel`, npm scripts etc. 10 | 11 | > I'm open to suggestion on improvements like adding or changing default rules so please feel free to open an issue. 12 | 13 | --- 14 | 15 | ## Table of Contents 16 | 17 | 18 | 19 | 20 | 21 | - [Installation](#installation) 22 | - [Usage](#usage) 23 | - [tsconfig.json](#tsconfigjson) 24 | - [TSLint](#tslint) 25 | - [tslint.json](#tslintjson) 26 | - [ESLint](#eslint) 27 | - [.eslintrc](#eslintrc) 28 | - [create-react-app](#create-react-app) 29 | - [LICENSE](#license) 30 | 31 | 32 | 33 | --- 34 | 35 | ## Installation 36 | 37 | This package is distributed via npm and should be installed as `devDependencies`: 38 | 39 | ``` 40 | npm i -D react-redux-typescript-scripts 41 | ``` 42 | 43 | > NOTE: You should also install optional dependencies listed for each tool in their **Usage** section. 44 | 45 | ## Usage 46 | 47 | You can find usage instructions for each tool in its own section below. 48 | 49 | ### tsconfig.json 50 | ```ts 51 | { 52 | "include": ["./src"], 53 | "extends": "./node_modules/react-redux-typescript-scripts/tsconfig.json", 54 | "compilerOptions": { 55 | // you can further customize options here 56 | } 57 | } 58 | ``` 59 | 60 | ### TSLint 61 | > **WARNING:** When using this config you'll need to install the additional dependencies listed below. 62 | ``` 63 | npm i -D tslint tslint-react 64 | ``` 65 | 66 | There are a few configs available (you can use one or all by declaring an array in `extends` config property): 67 | - `react-redux-typescript-scripts/tslint.json` - mandatory base config - based on recommended rules. 68 | - `react-redux-typescript-scripts/tslint-react.json`- additional react specific rules - based on `tslint-react`. 69 | 70 | #### tslint.json 71 | ```ts 72 | { 73 | "extends": [ 74 | "react-redux-typescript-scripts/tslint.json", 75 | "react-redux-typescript-scripts/tslint-react.json" // optional 76 | ], 77 | "rules": { 78 | // you can further customize options here 79 | } 80 | } 81 | ``` 82 | 83 | ### ESLint 84 | > **WARNING:** When using this config you'll need to install the additional dependencies listed below. 85 | ``` 86 | npm i -D eslint @typescript-eslint/eslint-plugin eslint-config-prettier 87 | ``` 88 | 89 | There are a few configs available (you can use one or all by declaring an array in `extends` config property): 90 | - `./node_modules/react-redux-typescript-scripts/eslint.json` - mandatory base config - based on recommended rules. 91 | - `./node_modules/react-redux-typescript-scripts/eslint-prettier.json`- disable eslint formatting related rules conflicting with prettier - based on `eslint-config-prettier` _(**WARNING:** Should be the last one in `extends` array)_. 92 | 93 | #### .eslintrc 94 | ```ts 95 | { 96 | "extends": [ 97 | "./node_modules/react-redux-typescript-scripts/eslint.js", 98 | "./node_modules/react-redux-typescript-scripts/eslint-prettier.js" // optional 99 | ], 100 | "rules": { 101 | // you can further customize options here 102 | } 103 | } 104 | ``` 105 | 106 | #### create-react-app 107 | To fully integrate `@typescript-eslint` with your `create-react-app` add the below snippet to your `.eslintrc` or `package.json` under the `eslintConfig` key: 108 | ```ts 109 | { 110 | "extends": [ 111 | "react-app", 112 | "./node_modules/react-redux-typescript-scripts/eslint.js", 113 | "./node_modules/react-redux-typescript-scripts/eslint-prettier.js" // optional 114 | ], 115 | } 116 | ``` 117 | 118 | ## LICENSE 119 | 120 | [MIT](./LICENSE) 121 | --------------------------------------------------------------------------------