Skip to content

Instantly share code, notes, and snippets.

@katsu-o
Last active January 19, 2019 14:53
Show Gist options
  • Save katsu-o/fbae2c18b0c9e0b6efb4b92afd834c04 to your computer and use it in GitHub Desktop.
Save katsu-o/fbae2c18b0c9e0b6efb4b92afd834c04 to your computer and use it in GitHub Desktop.
Settings of tslint/prettier after scaffolding by CRA(TypeScript)
# create-react-app
> 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
{
...,
"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"
}
}
{
"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,
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-pascal-case",
"allow-leading-underscore"
],
"import-name": false,
"ordered-imports": false,
"interface-name": false,
"no-empty-interface": false,
"object-literal-sort-keys": false,
"object-literal-shorthand": false,
"jsx-no-lambda": false,
"no-submodule-imports": [true, "excluded-module1", "excluded-module2"]
},
"jsRules": {}
}
{
"editor.formatOnSave": true,
"tslint.autoFixOnSave": true,
"tslint.packageManager": "yarn",
"prettier.singleQuote": true,
"prettier.semi": true,
"prettier.printWidth": 120,
"prettier.trailingComma": "es5"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment