Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f3c344

Browse files
authored
chore: upgrade to prettier 2.0 (typescript-eslint#1970)
1 parent b18bc35 commit 1f3c344

36 files changed

+301
-292
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ jobs:
167167
yarn check-clean-workspace-after-install
168168
169169
- name: Run unit tests
170-
run: yarn test
170+
# the internal plugin is only run locally, so it doesn't have to support older versions
171+
run: yarn test --ignore @typescript-eslint/eslint-plugin-internal
171172
env:
172173
CI: true
173174

.prettierrc.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
2+
"arrowParens": "avoid",
3+
"bracketSpacing": true,
4+
"endOfLine": "lf",
5+
"jsxBracketSameLine": false,
6+
"jsxSingleQuote": false,
7+
"printWidth": 80,
8+
"proseWrap": "preserve",
9+
"quoteProps": "as-needed",
10+
"semi": true,
211
"singleQuote": true,
3-
"trailingComma": "all"
12+
"tabWidth": 2,
13+
"trailingComma": "all",
14+
"useTabs": false
415
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"@commitlint/config-lerna-scopes": "^8.3.4",
6060
"@types/jest": "^25.1.0",
6161
"@types/node": "^12.12.7",
62+
"@types/prettier": "^2.0.0",
6263
"all-contributors-cli": "^6.11.0",
6364
"cspell": "^4.0.43",
6465
"cz-conventional-changelog": "^3.0.2",
@@ -73,7 +74,7 @@
7374
"lerna": "^3.20.2",
7475
"lint-staged": "^9.4.3",
7576
"markdownlint-cli": "^0.22.0",
76-
"prettier": "^1.19.1",
77+
"prettier": "^2.0.5",
7778
"ts-jest": "^25.0.0",
7879
"ts-node": "^8.5.0",
7980
"tslint": "^6.1.0",

packages/eslint-plugin/docs/rules/explicit-function-return-type.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function test() {
1818
}
1919

2020
// Should indicate that a number is returned
21-
var fn = function() {
21+
var fn = function () {
2222
return 1;
2323
};
2424

@@ -42,7 +42,7 @@ function test(): void {
4242
}
4343

4444
// A return value of type number
45-
var fn = function(): number {
45+
var fn = function (): number {
4646
return 1;
4747
};
4848

@@ -119,7 +119,7 @@ Examples of **correct** code for this rule with `{ allowExpressions: true }`:
119119
```ts
120120
node.addEventListener('click', () => {});
121121

122-
node.addEventListener('click', function() {});
122+
node.addEventListener('click', function () {});
123123

124124
const foo = arr.map(i => i * i);
125125
```
@@ -131,7 +131,7 @@ Examples of **incorrect** code for this rule with `{ allowTypedFunctionExpressio
131131
```ts
132132
let arrowFn = () => 'test';
133133

134-
let funcExpr = function() {
134+
let funcExpr = function () {
135135
return 'test';
136136
};
137137

@@ -186,7 +186,7 @@ Examples of **incorrect** code for this rule with `{ allowHigherOrderFunctions:
186186
var arrowFn = () => () => {};
187187

188188
function fn() {
189-
return function() {};
189+
return function () {};
190190
}
191191
```
192192

@@ -196,7 +196,7 @@ Examples of **correct** code for this rule with `{ allowHigherOrderFunctions: tr
196196
var arrowFn = () => (): void => {};
197197

198198
function fn() {
199-
return function(): void {};
199+
return function (): void {};
200200
}
201201
```
202202

packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function test() {
1717
}
1818

1919
// Should indicate that a number is returned
20-
export default function() {
20+
export default function () {
2121
return 1;
2222
}
2323

@@ -44,7 +44,7 @@ function test() {
4444
}
4545

4646
// A return value of type number
47-
export var fn = function(): number {
47+
export var fn = function (): number {
4848
return 1;
4949
};
5050

@@ -129,7 +129,7 @@ Examples of **incorrect** code for this rule with `{ allowTypedFunctionExpressio
129129
```ts
130130
export let arrowFn = () => 'test';
131131

132-
export let funcExpr = function() {
132+
export let funcExpr = function () {
133133
return 'test';
134134
};
135135

@@ -147,7 +147,7 @@ type FuncType = () => string;
147147

148148
export let arrowFn: FuncType = () => 'test';
149149

150-
export let funcExpr: FuncType = function() {
150+
export let funcExpr: FuncType = function () {
151151
return 'test';
152152
};
153153

@@ -179,11 +179,11 @@ Examples of **incorrect** code for this rule with `{ allowHigherOrderFunctions:
179179
export var arrowFn = () => () => {};
180180

181181
export function fn() {
182-
return function() {};
182+
return function () {};
183183
}
184184

185185
export function foo(outer) {
186-
return function(inner): void {};
186+
return function (inner): void {};
187187
}
188188
```
189189

@@ -193,11 +193,11 @@ Examples of **correct** code for this rule with `{ allowHigherOrderFunctions: tr
193193
export var arrowFn = () => (): void => {};
194194

195195
export function fn() {
196-
return function(): void {};
196+
return function (): void {};
197197
}
198198

199199
export function foo(outer: string) {
200-
return function(inner: string): void {};
200+
return function (inner: string): void {};
201201
}
202202
```
203203

packages/eslint-plugin/docs/rules/no-explicit-any.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function foo4(...args: ReadonlyArray<any>): void {}
122122
declare function bar(...args: any[]): void;
123123

124124
const baz = (...args: any[]) => {};
125-
const qux = function(...args: any[]) {};
125+
const qux = function (...args: any[]) {};
126126

127127
type Quux = (...args: any[]) => void;
128128
type Quuz = new (...args: any[]) => void;
@@ -151,7 +151,7 @@ function foo4(...args: ReadonlyArray<any>): void {}
151151
declare function bar(...args: any[]): void;
152152

153153
const baz = (...args: any[]) => {};
154-
const qux = function(...args: any[]) {};
154+
const qux = function (...args: any[]) {};
155155

156156
type Quux = (...args: any[]) => void;
157157
type Quuz = new (...args: any[]) => void;

packages/eslint-plugin/docs/rules/no-floating-promises.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ This allows you to skip checking of async iife
8383
Examples of **correct** code for this rule with `{ ignoreIIFE: true }`:
8484

8585
```ts
86-
await(async function() {
86+
await(async function () {
8787
await res(1);
8888
})();
8989

90-
(async function() {
90+
(async function () {
9191
await res(1);
9292
})();
9393
```

packages/eslint-plugin/docs/rules/no-implied-eval.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,27 @@ Examples of **correct** code for this rule:
5656
```ts
5757
/* eslint @typescript-eslint/no-implied-eval: "error" */
5858

59-
setTimeout(function() {
59+
setTimeout(function () {
6060
alert('Hi!');
6161
}, 100);
6262

63-
setInterval(function() {
63+
setInterval(function () {
6464
alert('Hi!');
6565
}, 100);
6666

67-
setImmediate(function() {
67+
setImmediate(function () {
6868
alert('Hi!');
6969
});
7070

71-
execScript(function() {
71+
execScript(function () {
7272
alert('Hi!');
7373
});
7474

7575
const fn = () => {};
7676
setTimeout(fn, 100);
7777

7878
const foo = {
79-
fn: function() {},
79+
fn: function () {},
8080
};
8181
setTimeout(foo.fn, 100);
8282
setTimeout(foo.fn.bind(this), 100);

packages/eslint-plugin/docs/rules/no-this-alias.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Rationale from TSLint:
1414
> ```js
1515
> const self = this;
1616
>
17-
> setTimeout(function() {
17+
> setTimeout(function () {
1818
> self.doWork();
1919
> });
2020
> ```

packages/eslint-plugin/docs/rules/typedef.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ function logsSize(size): void {
164164
console.log(size);
165165
}
166166

167-
const doublesSize = function(size): number {
167+
const doublesSize = function (size): number {
168168
return size * 2;
169169
};
170170

171171
const divider = {
172172
curriesSize(size): number {
173173
return size;
174174
},
175-
dividesSize: function(size): number {
175+
dividesSize: function (size): number {
176176
return size / 2;
177177
},
178178
};
@@ -192,15 +192,15 @@ function logsSize(size: number): void {
192192
console.log(size);
193193
}
194194

195-
const doublesSize = function(size: number): number {
195+
const doublesSize = function (size: number): number {
196196
return size * 2;
197197
};
198198

199199
const divider = {
200200
curriesSize(size: number): number {
201201
return size;
202202
},
203-
dividesSize: function(size: number): number {
203+
dividesSize: function (size: number): number {
204204
return size / 2;
205205
},
206206
};

packages/eslint-plugin/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@
4747
"tsutils": "^3.17.1"
4848
},
4949
"devDependencies": {
50-
"@types/json-schema": "^7.0.3",
5150
"@types/marked": "^0.7.1",
52-
"@types/prettier": "^1.18.2",
5351
"chalk": "^3.0.0",
5452
"marked": "^0.7.0",
5553
"prettier": "*",

packages/eslint-plugin/src/rules/consistent-type-assertions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ type MessageIds =
1010
| 'angle-bracket'
1111
| 'never'
1212
| 'unexpectedObjectTypeAssertion';
13-
// https://github.com/prettier/prettier/issues/4794
1413
type OptUnion =
1514
| {
1615
assertionStyle: 'as' | 'angle-bracket';

packages/eslint-plugin/src/rules/explicit-member-accessibility.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export default util.createRule<Options, MessageIds>({
166166
| TSESTree.ClassProperty
167167
| TSESTree.TSParameterProperty,
168168
): TSESLint.ReportFixFunction {
169-
return function(fixer: TSESLint.RuleFixer): TSESLint.RuleFix {
169+
return function (fixer: TSESLint.RuleFixer): TSESLint.RuleFix {
170170
const tokens = sourceCode.getTokens(node);
171171
let rangeToRemove: TSESLint.AST.Range;
172172
for (let i = 0; i < tokens.length; i++) {

packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default util.createRule<[], MessageIds>({
106106

107107
if (comparison) {
108108
context.report({
109-
fix: function*(fixer) {
109+
fix: function* (fixer) {
110110
yield fixer.removeRange(comparison.range);
111111

112112
if (!comparison.forTruthy) {

packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export default util.createRule({
179179
TSQualifiedName(node: TSESTree.TSQualifiedName): void {
180180
visitNamespaceAccess(node, node.left, node.right);
181181
},
182-
'MemberExpression[computed=false]': function(
182+
'MemberExpression[computed=false]': function (
183183
node: TSESTree.MemberExpression,
184184
): void {
185185
const property = node.property as TSESTree.Identifier;

packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class Test {
221221
}
222222
`,
223223
// examples from https://github.com/nzakas/eslint-plugin-typescript/issues/138
224-
'export default function<T>(foo: T) {}',
224+
'export default function <T>(foo: T) {}',
225225
'export default function named<T>(foo: T) {}',
226226
`
227227
interface Foo {

0 commit comments

Comments
 (0)