Skip to content

Commit

Permalink
ci: upgrade Node.js version (#619)
Browse files Browse the repository at this point in the history
- Upgrades Node.js version in Github actions
- Removes @scaleleap/utils package
nguyentoanit authored May 8, 2024
1 parent aecb3a2 commit c86924b
Showing 7 changed files with 2,676 additions and 6,899 deletions.
204 changes: 203 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,203 @@
module.exports = require('@scaleleap/utils/eslint')
const eslint = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 9,
sourceType: 'module',
project: './tsconfig.json',
},
ignorePatterns: ['.eslintrc.js', 'dist'],
env: {
node: true,
browser: true,
es6: true,
jest: true,
'jest/globals': true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'airbnb-base',
'prettier',
'plugin:eslint-comments/recommended',
'plugin:jest/all',
'plugin:jest-formatting/strict',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
],
plugins: [
'import',
'prettier',
'@typescript-eslint',
'simple-import-sort',
'jest',
'jest-formatting',
'sonarjs',
],
globals: {},
rules: {
curly: ['error', 'all'],

'prettier/prettier': [
'error',
{
endOfLine: 'lf',
printWidth: 100,
semi: false,
singleQuote: true,
trailingComma: 'all',
},
],

'no-underscore-dangle': 'off',
'no-restricted-syntax': 'off',

'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'import/prefer-default-export': 'off',

'class-methods-use-this': 'off',
'sort-imports': 'off',
'import/order': 'off',
'import/extensions': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.test.ts',
'test/**/*.ts',
],
},
],

'simple-import-sort/imports': 'error',
'jest/no-hooks': 'off',
'jest/valid-title': [
'error',
{
ignoreTypeOfDescribeName: true,
}
],

'@typescript-eslint/no-unnecessary-type-constraint': 'off',
'default-param-last': 'off',
'jest/max-expects': 'off',
'jest/no-conditional-in-test': 'off',
'jest/no-untyped-mock-factory': 'off',
'jest/prefer-mock-promise-shorthand': 'off',
'jest/prefer-snapshot-hint': 'off',
'jest/require-hook': 'off',
'jest/unbound-method': 'off',
'no-promise-executor-return': 'off',
'prefer-regex-literals': 'off',
'sonarjs/no-gratuitous-expressions': 'off',
'sonarjs/prefer-single-boolean-return': 'off',
'unicorn/expiring-todo-comments': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/no-empty-file': 'off',
'unicorn/no-useless-promise-resolve-reject': 'off',
'unicorn/prefer-export-from': 'off',
'unicorn/prefer-json-parse-buffer': 'off',
'unicorn/prefer-module': 'off',
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
'import/resolver': {
typescript: {
// https://github.com/benmosher/eslint-plugin-import/issues/1485#issuecomment-535351922
},
node: {
extensions: ['.js', '.ts', '.json'],
},
},
'import/extensions': ['.js', '.ts', '.mjs'],
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'consistent-return': 'off',

// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/781
'unicorn/no-array-callback-reference': 'off',

// duplicate of @typescript-eslint/no-unused-vars
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',

// https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
'no-undef': 'off',

// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],

// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
// note you must disable the base rule as it can report incorrect errors
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': ['error'],

// note you must disable the base rule as it can report incorrect errors
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': ['error'],

'no-redeclare': 'off',

'@typescript-eslint/no-redeclare': 'off',

'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],

// perfer to use single quites
'@typescript-eslint/quotes': [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],

'unicorn/prefer-top-level-await': 'off',
},
},
{
files: ['*.test.ts'],
rules: {
'max-classes-per-file': 'off',
},
},
],
}

eslint.rules['no-new'] = 0
eslint.rules['@typescript-eslint/explicit-module-boundary-types'] = 'off'

/**
* This looks like a garbage ESM rule.
* Wants everything prefixed with "node:*"
*/
eslint.rules['unicorn/prefer-node-protocol'] = 0

eslint.rules['unicorn/numeric-separators-style'] = 0

eslint.rules['jest/expect-expect'] = [
'error',
{
assertFunctionNames: ['expect', 'expectCDK'],
},
]

eslint.rules['@typescript-eslint/no-unused-vars'] = [
'error',
{
ignoreRestSiblings: true,
},
]

eslint.rules['@typescript-eslint/no-unsafe-declaration-merging'] = 0

module.exports = eslint
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18

- name: Install
run: npm ci
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18

- name: Install
run: npm ci
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@ jobs:
strategy:
matrix:
node:
- 14
- 16
- 18
os:
- ubuntu-latest
- macOS-latest
9,349 changes: 2,456 additions & 6,893 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -32,9 +32,20 @@
"@lavadrop/ensure": "1.0.0"
},
"devDependencies": {
"@scaleleap/utils": "1.9.98",
"@types/jest": "29.5.12",
"@types/node": "20.12.10",
"@typescript-eslint/eslint-plugin": "7.5.0",
"@typescript-eslint/parser": "7.5.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-jest": "27.9.0",
"eslint-plugin-jest-formatting": "3.1.0",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-simple-import-sort": "12.0.0",
"eslint-plugin-sonarjs": "0.25.0",
"eslint-plugin-unicorn": "51.0.1",
"danger": "12.2.0",
"jest": "29.7.0",
"rimraf": "5.0.5",
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
"target": "ES2019"
},
"include": [
"src/**/*"
"src/**/*",
"test/**/*.ts"
]
}

0 comments on commit c86924b

Please sign in to comment.