Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit 78a4fd0

Browse files
nielsdB97DorianGrey
authored andcommittedMar 23, 2018
Replace TSLint rules with presets (#281)
* Added tslint-config-prettier package * Replaced custom rules with tslint recommended preset and tslint-react * Use tslint-config-prettier to use prettier codestyle by default * Added type definitions and use correct import syntax for images * Fixed linting errors * Added linterOptions to ignore irrelevant files
1 parent 021b42a commit 78a4fd0

File tree

5 files changed

+14
-100
lines changed

5 files changed

+14
-100
lines changed
 

‎packages/react-scripts/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"ts-loader": "^2.3.7",
4949
"tsconfig-paths-webpack-plugin": "^2.0.0",
5050
"tslint": "^5.7.0",
51+
"tslint-config-prettier": "^1.10.0",
5152
"tslint-react": "^3.2.0",
5253
"uglifyjs-webpack-plugin": "^1.1.8",
5354
"url-loader": "0.6.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module '*.svg'
2+
declare module '*.png'
3+
declare module '*.jpg'

‎packages/react-scripts/template/src/App.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as React from 'react';
22
import './App.css';
33

4-
const logo = require('./logo.svg');
4+
import logo from './logo.svg';
55

66
class App extends React.Component {
7-
render() {
7+
public render() {
88
return (
99
<div className="App">
1010
<header className="App-header">

‎packages/react-scripts/template/src/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from 'react';
22
import * as ReactDOM from 'react-dom';
33
import App from './App';
4-
import registerServiceWorker from './registerServiceWorker';
54
import './index.css';
5+
import registerServiceWorker from './registerServiceWorker';
66

77
ReactDOM.render(
88
<App />,
+7-97
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,9 @@
11
{
2-
"extends": ["tslint-react"],
3-
"rules": {
4-
"align": [
5-
true,
6-
"parameters",
7-
"arguments",
8-
"statements"
9-
],
10-
"ban": false,
11-
"class-name": true,
12-
"comment-format": [
13-
true,
14-
"check-space"
15-
],
16-
"curly": true,
17-
"eofline": false,
18-
"forin": true,
19-
"indent": [ true, "spaces" ],
20-
"interface-name": [true, "never-prefix"],
21-
"jsdoc-format": true,
22-
"jsx-no-lambda": false,
23-
"jsx-no-multiline-js": false,
24-
"label-position": true,
25-
"max-line-length": [ true, 120 ],
26-
"member-ordering": [
27-
true,
28-
"public-before-private",
29-
"static-before-instance",
30-
"variables-before-functions"
31-
],
32-
"no-any": true,
33-
"no-arg": true,
34-
"no-bitwise": true,
35-
"no-console": [
36-
true,
37-
"log",
38-
"error",
39-
"debug",
40-
"info",
41-
"time",
42-
"timeEnd",
43-
"trace"
44-
],
45-
"no-consecutive-blank-lines": true,
46-
"no-construct": true,
47-
"no-debugger": true,
48-
"no-duplicate-variable": true,
49-
"no-empty": true,
50-
"no-eval": true,
51-
"no-shadowed-variable": true,
52-
"no-string-literal": true,
53-
"no-switch-case-fall-through": true,
54-
"no-trailing-whitespace": false,
55-
"no-unused-expression": true,
56-
"no-use-before-declare": true,
57-
"one-line": [
58-
true,
59-
"check-catch",
60-
"check-else",
61-
"check-open-brace",
62-
"check-whitespace"
63-
],
64-
"quotemark": [true, "single", "jsx-double"],
65-
"radix": true,
66-
"semicolon": [true, "always"],
67-
"switch-default": true,
68-
69-
"trailing-comma": [false],
70-
71-
"triple-equals": [ true, "allow-null-check" ],
72-
"typedef": [
73-
true,
74-
"parameter",
75-
"property-declaration"
76-
],
77-
"typedef-whitespace": [
78-
true,
79-
{
80-
"call-signature": "nospace",
81-
"index-signature": "nospace",
82-
"parameter": "nospace",
83-
"property-declaration": "nospace",
84-
"variable-declaration": "nospace"
85-
}
86-
],
87-
"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"],
88-
"whitespace": [
89-
true,
90-
"check-branch",
91-
"check-decl",
92-
"check-module",
93-
"check-operator",
94-
"check-separator",
95-
"check-type",
96-
"check-typecast"
97-
]
98-
}
2+
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
3+
"linterOptions": {
4+
"exclude": [
5+
"config/**/*.js",
6+
"node_modules/**/*.ts"
7+
]
8+
}
999
}

0 commit comments

Comments
 (0)