Skip to content

Commit b79462c

Browse files
authored
feat: Add definitive .editorconfig to use across sofie projects (#33)
Based on various .editorconfigs in sofie projects, without specifying the size of tabs. The point of tabs is that the user can configure how wide they want them in their particular editor.
1 parent 7980b03 commit b79462c

File tree

4 files changed

+51
-25
lines changed

4 files changed

+51
-25
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
insert_final_newline = true
9+
10+
[*.{yml,yaml}]
11+
indent_style = space
12+
indent_size = 2
13+
14+
[*.{md,diff,patch}]
15+
# Trailing whitespace is meaningful in these file types
16+
trim_trailing_whitespace = false
17+
18+
[*.md]
19+
# Markdown files indent with spaces, but sometimes include code blocks that use tabs
20+
indent_style = unset

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@ This readme assumes you are using yarn v4. For other package managers the steps
2828

2929
```json
3030
{
31-
...,
32-
"scripts": {
33-
...,
31+
...,
32+
"scripts": {
33+
...,
3434
"prepare": "husky",
3535
"lint:raw": "eslint",
36-
"lint": "run lint:raw .",
37-
"lint-fix": "run lint --fix",
38-
"license-validate": "sofie-licensecheck"
39-
},
40-
"prettier": "@sofie-automation/code-standard-preset/.prettierrc.json",
41-
"lint-staged": {
42-
"*.{css,json,md,scss}": [
43-
"prettier --write"
44-
],
45-
"*.{ts,tsx,js,jsx}": [
46-
"run lint:raw --fix"
47-
]
48-
},
49-
...
36+
"lint": "run lint:raw .",
37+
"lint-fix": "run lint --fix",
38+
"license-validate": "sofie-licensecheck"
39+
},
40+
"prettier": "@sofie-automation/code-standard-preset/.prettierrc.json",
41+
"lint-staged": {
42+
"*.{css,json,md,scss}": [
43+
"prettier --write"
44+
],
45+
"*.{ts,tsx,js,jsx}": [
46+
"run lint:raw --fix"
47+
]
48+
},
49+
...
5050
}
5151
```
5252

@@ -152,6 +152,8 @@ _Note: replace the {{PACKAGE-NAME}} with the correct package name, i.e. `hyperde
152152
* text=auto eol=lf
153153
```
154154

155+
Also copy the `.editorconfig` file from this repository if you want to use it.
156+
155157
**Adjust** jest configuration files to use `tsconfig.json`. For example, update the start of `jest.config.js` ...
156158

157159
```javascript

bin/checkLicenses.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ import path from 'path'
66
import checker from 'license-checker'
77

88
const cli = meow(
9+
// editorconfig-checker-disable -- The below string should be formatted with spaces
910
`
1011
Usage
1112
$ sofie-licensecheck
12-
$ sofie-licensecheck --allowPackages "package-name@1.2.3;other-package@1.2.3"
13+
$ sofie-licensecheck --allowPackages "package-name@1.2.3;other-package@1.2.3"
1314
1415
Options
15-
--debug Show full packages list
16-
--allowPackages Semi-colon separated list of packages to ignore (eg cycle@1.0.3;underscore@1.12.0)
17-
--allowList Which default list of licenses to use. Possible values: "MIT", "none". Defaults to "MIT"
18-
--allowLicenses Semi-colon separated list of licenses to allow in addition to the default list (eg GPL-3.0-only;MIT)
16+
--debug Show full packages list
17+
--allowPackages Semi-colon separated list of packages to ignore (eg cycle@1.0.3;underscore@1.12.0)
18+
--allowList Which default list of licenses to use. Possible values: "MIT", "none". Defaults to "MIT"
19+
--allowLicenses Semi-colon separated list of licenses to allow in addition to the default list (eg GPL-3.0-only;MIT)
1920
`,
21+
// editorconfig-checker-enable
2022
{
2123
importMeta: import.meta,
2224
flags: {

bin/updateVersion.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ import meow from 'meow'
77
import { format } from 'date-fns'
88

99
const cli = meow(
10+
// editorconfig-checker-disable -- The below string should be formatted with spaces
1011
`
1112
Usage
1213
$ sofie-version
1314
1415
Options
15-
--dry-run Simulate the version update process
16-
--prerelease Whether to tag a prerelease build, and the suffix to use
17-
--lastTag Optionally specify the last tag in the existing changelog
16+
--dry-run Simulate the version update process
17+
--prerelease Whether to tag a prerelease build, and the suffix to use
18+
--lastTag Optionally specify the last tag in the existing changelog
1819
`,
20+
// editorconfig-checker-enable
1921
{
2022
importMeta: import.meta,
2123
flags: {

0 commit comments

Comments
 (0)