Last active
September 11, 2018 04:03
-
-
Save katsu-o/127ff4b1ee59b5699d22852bc927a26a to your computer and use it in GitHub Desktop.
create-react-app + TypeScript の後の tslint/prettier 設定(VSCode) ref: https://qiita.com/katsu-o/items/370cd143087574cd66da
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create-react-app(TypeScript) | |
> create-react-app --scripts-version=react-scripts-ts <your-project> | |
> cd <your-project> | |
# tslint, prettier | |
> yarn add --dev tslint prettier tslint-config-prettier tslint-config-airbnb tslint-plugin-prettier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
..., | |
"scripts": { | |
..., | |
"tslint:prettier-check": "tslint-config-prettier-check ./tslint.json", | |
"tslint": "tslint --fix --force --format stylish --project ./tsconfig.json ./{src,__tests__}/**/*.{ts,tsx}", | |
"prettier": "prettier --write ./{src,__tests__}/**/*.{ts,tsx}" | |
}, | |
..., | |
"prettier": { | |
"semi": true, | |
"singleQuote": true, | |
"printWidth": 120, | |
"trailingComma": "es5" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.formatOnSave": true, | |
"tslint.autoFixOnSave": true, | |
"tslint.packageManager": "yarn", | |
"prettier.singleQuote": true, | |
"prettier.semi": true, | |
"prettier.printWidth": 120, | |
"prettier.trailingComma": "es5" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"defaultSeverity": "error", | |
"rulesDirectory": ["tslint-plugin-prettier"], | |
"extends": ["tslint:latest", "tslint-react", "tslint-config-airbnb", "tslint-config-prettier"], | |
"linterOptions": { | |
"exclude": ["config/**/*.js", "node_modules/**/*.ts", "coverage/lcov-report/*.js"] | |
}, | |
"rules": { | |
"prettier": [ | |
true, | |
{ | |
"semi": true, | |
"singleQuote": true, | |
"printWidth": 120, | |
"trailingComma": "es5" | |
} | |
], | |
"no-console": false, // console のメソッドを許容しない | |
"variable-name": [ | |
true, // 変数名をチェックする | |
"ban-keywords", // 予約語の禁止 | |
"check-format", // lowerCamel と UPPER_SNAKE を許容 | |
"allow-pascal-case", // UpperCamel を許容 | |
"allow-leading-underscore" // 先頭の underscore を許容 | |
], | |
"import-name": false, // import 名の制約 #tslint-microsoft-contrib | |
"ordered-imports": false, // import の順序指定 | |
"interface-name": false, // インターフェース名の制約(Iから始める) | |
"no-empty-interface": false, // 空の Interface を許容しない | |
"object-literal-sort-keys": false, // オブジェクトリテラルのキーをアルファベット順に並べることを強制する | |
"object-literal-shorthand": false, // オブジェクトリテラルの省略記法を推奨する | |
"jsx-no-lambda": false, // jsx 内での lambda の使用を許容しない | |
"no-submodule-imports": [true, "excluded-module1", "excluded-module2"] // サブモジュールの import を許容しない | |
}, | |
"jsRules": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment