Skip to content

Commit 8e19e3f

Browse files
authored
Setup Prettier code style (#51)
1 parent 9db9914 commit 8e19e3f

18 files changed

+481
-643
lines changed

.eslintrc

+14-220
Original file line numberDiff line numberDiff line change
@@ -1,222 +1,16 @@
11
{
2-
"parser": "@typescript-eslint/parser",
3-
4-
"plugins": [
5-
"@typescript-eslint"
6-
],
7-
8-
"extends": [
9-
"eslint:recommended",
10-
"plugin:@typescript-eslint/recommended"
11-
],
12-
13-
"env": {
14-
"browser": true,
15-
"es6": true,
16-
"node": true,
17-
"mocha": true
18-
},
19-
20-
"parserOptions": {
21-
"ecmaVersion": 7,
22-
"sourceType": "module",
23-
"ecmaFeatures": {
24-
"arrowFunctions": true,
25-
"binaryLiterals": true,
26-
"blockBindings": true,
27-
"classes": true,
28-
"defaultParams": true,
29-
"destructuring": true,
30-
"experimentalObjectRestSpread": true,
31-
"forOf": true,
32-
"generators": true,
33-
"globalReturn": true,
34-
"jsx": true,
35-
"modules": true,
36-
"objectLiteralComputedProperties": true,
37-
"objectLiteralDuplicateProperties": true,
38-
"objectLiteralShorthandMethods": true,
39-
"objectLiteralShorthandProperties": true,
40-
"octalLiterals": true,
41-
"regexUFlag": true,
42-
"regexYFlag": true,
43-
"restParams": true,
44-
"spread": true,
45-
"superInFunctions": true,
46-
"templateStrings": true,
47-
"unicodeCodePointEscapes": true
48-
}
49-
},
50-
51-
"rules": {
52-
"arrow-parens": [2, "as-needed"],
53-
"array-bracket-spacing": [2, "always"],
54-
"generator-star-spacing": [2, {"before": true, "after": false}],
55-
56-
"arrow-spacing": 2,
57-
"block-scoped-var": 0,
58-
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
59-
"callback-return": 2,
60-
"camelcase": [2, {"properties": "always"}],
61-
"comma-dangle": 0,
62-
"comma-spacing": 0,
63-
"comma-style": [2, "last"],
64-
"complexity": 0,
65-
"computed-property-spacing": [2, "never"],
66-
"consistent-return": 0,
67-
"consistent-this": 0,
68-
"curly": [2, "all"],
69-
"default-case": 0,
70-
"dot-location": [2, "property"],
71-
"dot-notation": 0,
72-
"eol-last": 2,
73-
"eqeqeq": 2,
74-
"func-names": 0,
75-
"func-style": 0,
76-
"guard-for-in": 2,
77-
"handle-callback-err": [2, "error"],
78-
"id-length": 0,
79-
"id-match": [2, "^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$"],
80-
"indent": [2, 2, {"SwitchCase": 1}],
81-
"init-declarations": 0,
82-
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
83-
"keyword-spacing": 2,
84-
"linebreak-style": 2,
85-
"lines-around-comment": 0,
86-
"max-depth": 0,
87-
"max-len": [2, 120, 4, {"ignoreStrings": true}],
88-
"max-nested-callbacks": 0,
89-
"max-params": 0,
90-
"max-statements": 0,
91-
"new-cap": 0,
92-
"new-parens": 2,
93-
"newline-after-var": 0,
94-
"no-alert": 2,
95-
"no-array-constructor": 2,
96-
"no-bitwise": 0,
97-
"no-caller": 2,
98-
"no-catch-shadow": 0,
99-
"no-class-assign": 2,
100-
"no-cond-assign": 2,
101-
"no-console": 1,
102-
"no-const-assign": 2,
103-
"no-constant-condition": 2,
104-
"no-continue": 0,
105-
"no-control-regex": 0,
106-
"no-debugger": 1,
107-
"no-delete-var": 2,
108-
"no-div-regex": 2,
109-
"no-dupe-args": 2,
110-
"no-dupe-keys": 2,
111-
"no-duplicate-case": 2,
112-
"no-else-return": 2,
113-
"no-empty": 2,
114-
"no-empty-character-class": 2,
115-
"no-eq-null": 0,
116-
"no-eval": 2,
117-
"no-ex-assign": 2,
118-
"no-extend-native": 2,
119-
"no-extra-bind": 2,
120-
"no-extra-boolean-cast": 2,
121-
"no-extra-parens": 0,
122-
"no-extra-semi": 2,
123-
"no-fallthrough": 2,
124-
"no-floating-decimal": 2,
125-
"no-func-assign": 2,
126-
"no-implicit-coercion": 2,
127-
"no-implied-eval": 2,
128-
"no-inline-comments": 0,
129-
"no-inner-declarations": [2, "functions"],
130-
"no-invalid-regexp": 2,
131-
"no-invalid-this": 0,
132-
"no-irregular-whitespace": 2,
133-
"no-iterator": 2,
134-
"no-label-var": 2,
135-
"no-labels": [2, {"allowLoop": true}],
136-
"no-lone-blocks": 2,
137-
"no-lonely-if": 2,
138-
"no-loop-func": 0,
139-
"no-mixed-requires": [2, true],
140-
"no-mixed-spaces-and-tabs": 2,
141-
"no-multi-spaces": 2,
142-
"no-multi-str": 2,
143-
"no-multiple-empty-lines": 0,
144-
"no-native-reassign": 0,
145-
"no-negated-in-lhs": 2,
146-
"no-nested-ternary": 0,
147-
"no-new": 2,
148-
"no-new-func": 0,
149-
"no-new-object": 2,
150-
"no-new-require": 2,
151-
"no-new-wrappers": 2,
152-
"no-obj-calls": 2,
153-
"no-octal": 2,
154-
"no-octal-escape": 2,
155-
"no-param-reassign": 2,
156-
"no-path-concat": 2,
157-
"no-plusplus": 0,
158-
"no-process-env": 0,
159-
"no-process-exit": 0,
160-
"no-proto": 2,
161-
"no-redeclare": 2,
162-
"no-regex-spaces": 2,
163-
"no-restricted-modules": 0,
164-
"no-return-assign": 2,
165-
"no-script-url": 2,
166-
"no-self-compare": 0,
167-
"no-sequences": 2,
168-
"no-shadow": 2,
169-
"no-shadow-restricted-names": 2,
170-
"no-spaced-func": 2,
171-
"no-sparse-arrays": 2,
172-
"no-sync": 2,
173-
"no-ternary": 0,
174-
"no-this-before-super": 2,
175-
"no-throw-literal": 2,
176-
"no-undef": 2,
177-
"no-undef-init": 2,
178-
"no-undefined": 0,
179-
"no-underscore-dangle": 0,
180-
"no-unexpected-multiline": 2,
181-
"no-unneeded-ternary": 2,
182-
"no-unreachable": 2,
183-
"no-unused-expressions": 2,
184-
"no-unused-vars": 2,
185-
"no-use-before-define": 0,
186-
"no-useless-call": 2,
187-
"no-var": 2,
188-
"no-void": 2,
189-
"no-warning-comments": 0,
190-
"no-with": 2,
191-
"object-curly-spacing": [0, "always"],
192-
"object-shorthand": [2, "always"],
193-
"one-var": [2, "never"],
194-
"operator-assignment": [2, "always"],
195-
"operator-linebreak": [2, "after"],
196-
"padded-blocks": 0,
197-
"prefer-const": 2,
198-
"prefer-reflect": 0,
199-
"prefer-spread": 0,
200-
"quote-props": [2, "as-needed"],
201-
"quotes": [2, "single"],
202-
"radix": 2,
203-
"require-yield": 2,
204-
"semi": [2, "always"],
205-
"semi-spacing": [2, {"before": false, "after": true}],
206-
"sort-vars": 0,
207-
"space-before-blocks": [2, "always"],
208-
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
209-
"space-in-parens": 0,
210-
"space-infix-ops": [2, {"int32Hint": false}],
211-
"space-unary-ops": [2, {"words": true, "nonwords": false}],
212-
"spaced-comment": [2, "always"],
213-
"strict": 0,
214-
"use-isnan": 2,
215-
"valid-jsdoc": 0,
216-
"valid-typeof": 2,
217-
"vars-on-top": 0,
218-
"wrap-iife": 2,
219-
"wrap-regex": 0,
220-
"yoda": [2, "never", {"exceptRange": true}]
221-
}
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/eslint-recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"env": {
11+
"browser": true,
12+
"es6": true,
13+
"node": true,
14+
"mocha": true
15+
}
22216
}

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80
6+
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"scripts": {
8-
"lint": "eslint --ext .ts .",
9-
"lint:fix": "npm run lint -- --fix",
8+
"lint": "eslint --ext .ts . && prettier --config .prettierrc 'src/**/*.ts' --check",
9+
"lint:fix": "eslint --ext .ts . --fix && prettier --config .prettierrc 'src/**/*.ts' --write",
1010
"clean": "rimraf dist/*",
1111
"build": "tsc",
1212
"test": "npm run lint && npm run testonly",
@@ -50,6 +50,7 @@
5050
"eslint": "^6.8.0",
5151
"graphql": "^14.5.0 || ^15.0.0",
5252
"mocha": "^7.1.1",
53+
"prettier": "^2.2.1",
5354
"rimraf": "^3.0.2",
5455
"ts-node": "^8.8.2",
5556
"typescript": "^3.8.3"

0 commit comments

Comments
 (0)