Skip to content

Commit 6b6a641

Browse files
committed
feat(core): CHECKOUT-3079 Extract TSLint recommended preset into standalone file
1 parent 19bbc55 commit 6b6a641

File tree

8 files changed

+1585
-0
lines changed

8 files changed

+1585
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## What?
2+
...
3+
4+
## Why?
5+
...
6+
7+
## Testing / Proof
8+
...
9+
10+
@bigcommerce/frontend

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.log
2+
/node_modules

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(The MIT License)
2+
Copyright (C) 2018-Present BigCommerce Inc.
3+
All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# @bigcommerce/tslint-config
2+
3+
4+
This package is a configuration preset for [TSLint](https://palantir.github.io/tslint). It contains a set of rules applied to most TypeScript projects at BigCommerce.
5+
6+
7+
## Install
8+
9+
```sh
10+
npm install --save @bigcommerce/tslint-config
11+
```
12+
13+
14+
## Usage
15+
16+
Add `@bigcommerce/tslint-config` to your project's TSLint configuration file. i.e.:
17+
18+
```json
19+
{
20+
"extends": "@bigcommerce/tslint-config"
21+
}
22+
```
23+
24+
If possible, try not to override the preset unless you have a special reason.
25+
26+
27+
## Release
28+
29+
To release:
30+
31+
```sh
32+
npm run release
33+
```
34+
35+
Please refer to the documentation of [standard-version](https://github.com/conventional-changelog/standard-version) for more options.
36+
37+
38+
## License
39+
40+
MIT

index.json

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
{
2+
"rules": {
3+
"adjacent-overload-signatures": true,
4+
"align": {
5+
"options": [
6+
"parameters",
7+
"statements"
8+
]
9+
},
10+
"array-type": {
11+
"options": [
12+
"array-simple"
13+
]
14+
},
15+
"arrow-parens": {
16+
"options": [
17+
"ban-single-arg-parens"
18+
]
19+
},
20+
"arrow-return-shorthand": true,
21+
"ban-types": {
22+
"options": [
23+
[
24+
"Object",
25+
"Avoid using the `Object` type. Did you mean `object`?"
26+
],
27+
[
28+
"Function",
29+
"Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
30+
],
31+
[
32+
"Boolean",
33+
"Avoid using the `Boolean` type. Did you mean `boolean`?"
34+
],
35+
[
36+
"Number",
37+
"Avoid using the `Number` type. Did you mean `number`?"
38+
],
39+
[
40+
"String",
41+
"Avoid using the `String` type. Did you mean `string`?"
42+
],
43+
[
44+
"Symbol",
45+
"Avoid using the `Symbol` type. Did you mean `symbol`?"
46+
]
47+
]
48+
},
49+
"callable-types": true,
50+
"class-name": true,
51+
"comment-format": {
52+
"options": [
53+
"check-space"
54+
]
55+
},
56+
"curly": true,
57+
"cyclomatic-complexity": false,
58+
"eofline": true,
59+
"forin": true,
60+
"import-spacing": true,
61+
"indent": {
62+
"options": [
63+
"spaces",
64+
4
65+
]
66+
},
67+
"interface-name": {
68+
"options": [
69+
"never-prefix"
70+
]
71+
},
72+
"interface-over-type-literal": true,
73+
"jsdoc-format": true,
74+
"label-position": true,
75+
"max-classes-per-file": {
76+
"options": [
77+
1
78+
]
79+
},
80+
"max-line-length": {
81+
"options": [
82+
120
83+
]
84+
},
85+
"member-access": {
86+
"options": [
87+
"no-public"
88+
]
89+
},
90+
"member-ordering": {
91+
"options": {
92+
"order": "statics-first"
93+
}
94+
},
95+
"new-parens": true,
96+
"no-angle-bracket-type-assertion": true,
97+
"no-any": false,
98+
"no-arg": true,
99+
"no-bitwise": true,
100+
"no-conditional-assignment": true,
101+
"no-consecutive-blank-lines": true,
102+
"no-console": true,
103+
"no-construct": true,
104+
"no-debugger": true,
105+
"no-duplicate-super": true,
106+
"no-empty": true,
107+
"no-empty-interface": true,
108+
"no-eval": true,
109+
"no-internal-module": true,
110+
"no-invalid-this": false,
111+
"no-misused-new": true,
112+
"no-namespace": {
113+
"options": [
114+
"allow-declarations"
115+
]
116+
},
117+
"no-parameter-properties": false,
118+
"no-reference": true,
119+
"no-reference-import": true,
120+
"no-shadowed-variable": true,
121+
"no-string-literal": true,
122+
"no-string-throw": true,
123+
"no-switch-case-fall-through": false,
124+
"no-trailing-whitespace": true,
125+
"no-unnecessary-initializer": true,
126+
"no-unsafe-finally": true,
127+
"no-unused-expression": true,
128+
"no-var-keyword": true,
129+
"no-var-requires": true,
130+
"object-literal-key-quotes": {
131+
"options": [
132+
"as-needed"
133+
]
134+
},
135+
"object-literal-shorthand": true,
136+
"object-literal-sort-keys": true,
137+
"one-line": {
138+
"options": [
139+
"check-catch",
140+
"check-else",
141+
"check-finally",
142+
"check-open-brace",
143+
"check-whitespace"
144+
]
145+
},
146+
"one-variable-per-declaration": {
147+
"options": [
148+
"ignore-for-loop"
149+
]
150+
},
151+
"only-arrow-functions": {
152+
"options": [
153+
"allow-declarations",
154+
"allow-named-functions"
155+
]
156+
},
157+
"ordered-imports": {
158+
"options": {
159+
"grouped-imports": true,
160+
"import-sources-order": "lowercase-first",
161+
"module-source-path": "full",
162+
"named-imports-order": "lowercase-first"
163+
}
164+
},
165+
"prefer-const": true,
166+
"prefer-for-of": true,
167+
"quotemark": {
168+
"options": [
169+
"single",
170+
"jsx-double",
171+
"avoid-escape"
172+
]
173+
},
174+
"radix": true,
175+
"semicolon": {
176+
"options": [
177+
"always",
178+
"strict-bound-class-methods"
179+
]
180+
},
181+
"space-before-function-paren": {
182+
"options": {
183+
"anonymous": "never",
184+
"asyncArrow": "always",
185+
"constructor": "never",
186+
"method": "never",
187+
"named": "never"
188+
}
189+
},
190+
"trailing-comma": {
191+
"options": {
192+
"multiline": {
193+
"arrays": "always",
194+
"functions": "never",
195+
"objects": "always",
196+
"typeLiterals": "always"
197+
},
198+
"singleline": "never"
199+
}
200+
},
201+
"triple-equals": {
202+
"options": [
203+
"allow-null-check"
204+
]
205+
},
206+
"typedef": false,
207+
"typedef-whitespace": {
208+
"options": [
209+
{
210+
"call-signature": "nospace",
211+
"index-signature": "nospace",
212+
"parameter": "nospace",
213+
"property-declaration": "nospace",
214+
"variable-declaration": "nospace"
215+
},
216+
{
217+
"call-signature": "onespace",
218+
"index-signature": "onespace",
219+
"parameter": "onespace",
220+
"property-declaration": "onespace",
221+
"variable-declaration": "onespace"
222+
}
223+
]
224+
},
225+
"typeof-compare": false,
226+
"unified-signatures": true,
227+
"use-isnan": true,
228+
"variable-name": {
229+
"options": [
230+
"ban-keywords",
231+
"check-format",
232+
"allow-leading-underscore",
233+
"allow-pascal-case"
234+
]
235+
},
236+
"whitespace": {
237+
"options": [
238+
"check-branch",
239+
"check-decl",
240+
"check-operator",
241+
"check-separator",
242+
"check-type",
243+
"check-typecast"
244+
]
245+
}
246+
}
247+
}

package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "@bigcommerce/tslint-config",
3+
"version": "0.0.0",
4+
"description": "Default TSLint configuration used at BigCommerce",
5+
"main": "index.json",
6+
"author": "BigCommerce",
7+
"license": "MIT",
8+
"repository": {
9+
"type": "git",
10+
"url": "git://github.com/bigcommerce/tslint-config.git"
11+
},
12+
"scripts": {
13+
"release": "standard-version"
14+
},
15+
"devDependencies": {
16+
"standard-version": "^4.3.0"
17+
},
18+
"peerDependencies": {
19+
"tslint": "^5.9.1"
20+
}
21+
}

0 commit comments

Comments
 (0)