diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 16ba41caa..1f70d715e 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -48,6 +48,7 @@ "ts-loader": "^2.3.7", "tsconfig-paths-webpack-plugin": "^2.0.0", "tslint": "^5.7.0", + "tslint-config-prettier": "^1.10.0", "tslint-react": "^3.2.0", "uglifyjs-webpack-plugin": "^1.1.8", "url-loader": "0.6.2", diff --git a/packages/react-scripts/template/images.d.ts b/packages/react-scripts/template/images.d.ts new file mode 100644 index 000000000..397cc9b35 --- /dev/null +++ b/packages/react-scripts/template/images.d.ts @@ -0,0 +1,3 @@ +declare module '*.svg' +declare module '*.png' +declare module '*.jpg' diff --git a/packages/react-scripts/template/src/App.tsx b/packages/react-scripts/template/src/App.tsx index 921bb811d..c1bc27ccd 100644 --- a/packages/react-scripts/template/src/App.tsx +++ b/packages/react-scripts/template/src/App.tsx @@ -1,10 +1,10 @@ import * as React from 'react'; import './App.css'; -const logo = require('./logo.svg'); +import logo from './logo.svg'; class App extends React.Component { - render() { + public render() { return (
diff --git a/packages/react-scripts/template/src/index.tsx b/packages/react-scripts/template/src/index.tsx index 1c66245ab..a7b130622 100644 --- a/packages/react-scripts/template/src/index.tsx +++ b/packages/react-scripts/template/src/index.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; import App from './App'; -import registerServiceWorker from './registerServiceWorker'; import './index.css'; +import registerServiceWorker from './registerServiceWorker'; ReactDOM.render( , diff --git a/packages/react-scripts/template/tslint.json b/packages/react-scripts/template/tslint.json index eb5d66a02..67823d8e1 100644 --- a/packages/react-scripts/template/tslint.json +++ b/packages/react-scripts/template/tslint.json @@ -1,99 +1,9 @@ { - "extends": ["tslint-react"], - "rules": { - "align": [ - true, - "parameters", - "arguments", - "statements" - ], - "ban": false, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "eofline": false, - "forin": true, - "indent": [ true, "spaces" ], - "interface-name": [true, "never-prefix"], - "jsdoc-format": true, - "jsx-no-lambda": false, - "jsx-no-multiline-js": false, - "label-position": true, - "max-line-length": [ true, 120 ], - "member-ordering": [ - true, - "public-before-private", - "static-before-instance", - "variables-before-functions" - ], - "no-any": true, - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "log", - "error", - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-consecutive-blank-lines": true, - "no-construct": true, - "no-debugger": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-shadowed-variable": true, - "no-string-literal": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": false, - "no-unused-expression": true, - "no-use-before-declare": true, - "one-line": [ - true, - "check-catch", - "check-else", - "check-open-brace", - "check-whitespace" - ], - "quotemark": [true, "single", "jsx-double"], - "radix": true, - "semicolon": [true, "always"], - "switch-default": true, - - "trailing-comma": [false], - - "triple-equals": [ true, "allow-null-check" ], - "typedef": [ - true, - "parameter", - "property-declaration" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-module", - "check-operator", - "check-separator", - "check-type", - "check-typecast" - ] - } + "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"], + "linterOptions": { + "exclude": [ + "config/**/*.js", + "node_modules/**/*.ts" + ] + } }