Skip to content

Commit b326da7

Browse files
Julusiannytamin
authored andcommitted
chore: update code-preset and configs
1 parent 6f853de commit b326da7

File tree

91 files changed

+1361
-2203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1361
-2203
lines changed

.husky/pre-commit

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
yarn lint-staged
1+
lint-staged

meteor/.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

meteor/.eslintrc.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

meteor/eslint.config.mjs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { generateEslintConfig } from '@sofie-automation/code-standard-preset/eslint/main.mjs'
2+
3+
const tmpRules = {
4+
// Temporary rules to be removed over time
5+
'@typescript-eslint/ban-types': 'off',
6+
'@typescript-eslint/no-namespace': 'off',
7+
'@typescript-eslint/no-var-requires': 'off',
8+
'@typescript-eslint/no-non-null-assertion': 'off',
9+
'@typescript-eslint/unbound-method': 'off',
10+
'@typescript-eslint/no-misused-promises': 'off',
11+
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
12+
'@typescript-eslint/no-require-imports': 'off',
13+
}
14+
15+
const extendedRules = await generateEslintConfig({
16+
// tsconfigName: 'tsconfig.eslint.json',
17+
ignores: ['.meteor', 'public', 'scripts', 'server/_force_restart.js', '/packages/'],
18+
19+
// disableNodeRules: true,
20+
})
21+
extendedRules.push({
22+
files: ['**/*'],
23+
rules: {
24+
// custom
25+
'no-inner-declarations': 'off', // some functions are unexported and placed inside a namespace next to related ones
26+
27+
'n/no-extraneous-import': 'off', // because there are a lot of them as dev-dependencies
28+
'n/no-missing-import': 'off', // erroring on every single import
29+
'react/prop-types': 'off', // we don't use this
30+
'@typescript-eslint/no-empty-interface': 'off', // many prop/state types are {}
31+
'@typescript-eslint/promise-function-async': 'off', // event handlers can't be async
32+
33+
'n/file-extension-in-import': ['error', 'never'], // Meteor breaks on importing ts files with a js extension
34+
35+
...tmpRules,
36+
},
37+
})
38+
39+
export default extendedRules

meteor/package.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"cov": "yarn unitcov && yarn cov-open",
2323
"license-validate": "node ../scripts/checkLicenses.js --allowed=\"MIT,BSD,ISC,Apache,Unlicense,CC0,LGPL,CC BY 3.0,CC BY 4.0,MPL 2.0,Python 2.0\" --excludePackages=timecode,rxjs/ajax,rxjs/fetch,rxjs/internal-compatibility,nw-pre-gyp-module-test,rxjs/operators,rxjs/testing,rxjs/webSocket,undefined,i18next-conv,@fortawesome/fontawesome-common-types,argv,indexof,custom-license,private,public-domain-module,@sofie-automation/corelib,@sofie-automation/shared-lib,@sofie-automation/job-worker",
2424
"lint": "run lint:raw .",
25-
"lint:raw": "eslint --ext .ts --ext .js --ext .tsx --ext .jsx",
25+
"lint:raw": "eslint",
2626
"lintfix": "run lint --fix",
2727
"quickformat": "prettier \"__mocks__/**\" --write ; prettier \"lib/**\" --write ; prettier \"server/**\" --write ; prettier \"client/**\" --write ; prettier \"*.json\" --write ; prettier \"*.js\" --write ; prettier \"*.md\" --write",
2828
"i18n-extract-pot": "node ./scripts/extract-i18next-pot.mjs -f \"{./lib/**/*.+(ts|tsx),./server/**/*.+(ts|tsx),../packages/job-worker/src/**/*.+(ts|tsx),../packages/corelib/src/**/*.+(ts|tsx),../packages/webui/src/**/*.+(ts|tsx)}\" -o i18n/template.pot",
@@ -78,8 +78,7 @@
7878
"@babel/core": "^7.26.7",
7979
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
8080
"@shopify/jest-koa-mocks": "^5.3.1",
81-
"@sofie-automation/code-standard-preset": "~2.4.7",
82-
"@sofie-automation/eslint-plugin": "^0.1.1",
81+
"@sofie-automation/code-standard-preset": "^3.0.0",
8382
"@types/app-root-path": "^1.2.8",
8483
"@types/body-parser": "^1.19.5",
8584
"@types/deep-extend": "^0.6.2",
@@ -94,27 +93,20 @@
9493
"@types/request": "^2.48.12",
9594
"@types/semver": "^7.5.8",
9695
"@types/underscore": "^1.13.0",
97-
"@typescript-eslint/eslint-plugin": "^5.62.0",
98-
"@typescript-eslint/parser": "^5.62.0",
99-
"@typescript-eslint/utils": "^5.62.0",
10096
"babel-jest": "^29.7.0",
10197
"ejson": "^2.2.3",
102-
"eslint": "^8.57.1",
103-
"eslint-config-prettier": "^8.10.0",
104-
"eslint-plugin-jest": "^27.9.0",
105-
"eslint-plugin-node": "^11.1.0",
106-
"eslint-plugin-prettier": "^4.2.1",
98+
"eslint": "^9.18.0",
10799
"fast-clone": "^1.5.13",
108100
"glob": "^11.0.1",
109101
"i18next-conv": "^10.2.0",
110102
"i18next-scanner": "^4.6.0",
111103
"jest": "^29.7.0",
112104
"legally": "^3.5.10",
113105
"open-cli": "^8.0.0",
114-
"prettier": "^2.8.8",
106+
"prettier": "^3.4.2",
115107
"standard-version": "^9.5.0",
116108
"ts-jest": "^29.2.5",
117-
"typescript": "~5.1.6",
109+
"typescript": "~5.7.3",
118110
"yargs": "^17.7.2"
119111
},
120112
"prettier": "@sofie-automation/code-standard-preset/.prettierrc.json",

meteor/server/systemStatus/systemStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const integrationVersionAllowPrerelease = isPrerelease(PackageInfo.version)
3434
// Any libraries that if a gateway uses should match a certain version
3535
const expectedLibraryVersions: { [libName: string]: string } = {
3636
'superfly-timeline': stripVersion(require('superfly-timeline/package.json').version),
37-
// eslint-disable-next-line node/no-extraneous-require
37+
// eslint-disable-next-line n/no-extraneous-require
3838
'@mos-connection/helper': stripVersion(require('@mos-connection/helper/package.json').version),
3939
}
4040

meteor/tsconfig-base.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,33 @@
33
"compilerOptions": {
44
/* At the time of writing we are not ready for stricter rules */
55
"strict": true,
6-
76
"target": "es2022",
8-
7+
"allowImportingTsExtensions": true,
98
"skipLibCheck": true,
109
"sourceMap": true,
1110
"allowJs": false,
12-
"lib": ["dom", "es2022", "dom.iterable", "scripthost"],
13-
11+
"lib": [
12+
"dom",
13+
"es2022",
14+
"dom.iterable",
15+
"scripthost"
16+
],
1417
"paths": {
1518
"meteor/*": [
1619
// "./node_modules/@types/meteor/*",
1720
"./.meteor/local/types/packages.d.ts"
1821
]
1922
}
2023
},
21-
"include": ["client/**/*", "server/**/*", "lib/**/*", "__mocks__/**/*", "tslint-rules/**/*"],
22-
"exclude": ["node_modules", "**/.coverage/**/*"]
24+
"include": [
25+
"client/**/*",
26+
"server/**/*",
27+
"lib/**/*",
28+
"__mocks__/**/*",
29+
"tslint-rules/**/*"
30+
],
31+
"exclude": [
32+
"node_modules",
33+
"**/.coverage/**/*"
34+
]
2335
}

0 commit comments

Comments
 (0)