Skip to content

Commit

Permalink
chore: update dependencies. add cz to husky hook. only use ESM
Browse files Browse the repository at this point in the history
Add some Eslint rules.
Only build the library to ESM and skip CommonJS.
Drop support for node 12
and 14.
Update all dependencies with a yarn plugin.

BREAKING CHANGE: Dropping the support for node 12. Dropping the support for node 14. The library
  • Loading branch information
blephy committed Jun 17, 2022
1 parent 190ea70 commit cee8d23
Show file tree
Hide file tree
Showing 16 changed files with 1,145 additions and 559 deletions.
36 changes: 22 additions & 14 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ module.exports = {
env: {
node: true,
commonjs: true,
es6: true,
es2020: true,
es2022: true,
},
settings: {
'import/extensions': ['.ts', '.mts', '.cts', '.tsx', '.js', '.mjs', '.cjs', '.jsx'],
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.mts', '.cts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.eslint.json',
},
},
jsdoc: {
tagNamePreference: {
returns: 'return',
node: {
extensions: ['.ts', '.mts', '.cts', '.tsx', '.js', '.mjs', '.cjs', '.jsx'],
},
},
},
Expand All @@ -25,6 +26,7 @@ module.exports = {
'eslint:recommended',
'plugin:jsdoc/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:eslint-comments/recommended',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
Expand Down Expand Up @@ -55,6 +57,11 @@ module.exports = {
],
},
rules: {
/**
* eslint plugin unicorn
*/
'unicorn/no-unused-properties': 'error',
'unicorn/no-unsafe-regex': 'error',
/**
* eslint plugin comments
*/
Expand Down Expand Up @@ -814,11 +821,11 @@ module.exports = {
prev: ['const', 'let'],
next: ['const', 'let'],
},
{
blankLine: 'never',
prev: ['export'],
next: ['export'],
},
// {
// blankLine: 'never',
// prev: ['export'],
// next: ['export'],
// },
{
blankLine: 'always',
prev: '*',
Expand Down Expand Up @@ -851,8 +858,8 @@ module.exports = {
'block',
'block-like',
'multiline-expression',
'require',
'import',
// 'require',
// 'import',
],
next: '*',
},
Expand Down Expand Up @@ -1568,7 +1575,7 @@ module.exports = {
'import/dynamic-import-chunkname': 'off',
'import/export': 'off',
'import/exports-last': 'error',
'import/extensions': 'off',
'import/extensions': 'off', // handled by TypeScript NodeNext
'import/first': 'error',
'import/group-exports': 'error',
'import/max-dependencies': 'off',
Expand Down Expand Up @@ -1631,6 +1638,7 @@ module.exports = {
],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'always',
warnOnUnassignedImports: true,
},
],
'sort-imports': ['error', { ignoreDeclarationSort: true }],
Expand Down
6 changes: 6 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

[ -n "$CI" ] && exit 0

exec < /dev/tty && npx cz --hook || true
2 changes: 1 addition & 1 deletion .markdownlint-cli2.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
ignores: ['CHANGELOG.md', 'node_modules'],
ignores: ['CHANGELOG.md', 'LICENSE', 'node_modules'],
config: {
default: true,
'no-inline-html': {
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.2.0
18.4.0
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"source.fixAll.tslint": false
},
"eslint.format.enable": false,
"markdownlint.ignore": ["CHANGELOG.md", "**/node_modules/**"],
"markdownlint.ignore": ["CHANGELOG.md", "LICENSE", "**/node_modules/**"],

// Jest extension settings
"jest.enableSnapshotUpdateMessages": true,
Expand Down
546 changes: 546 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
yarnPath: .yarn/releases/yarn-3.2.1.cjs

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'

yarnPath: .yarn/releases/yarn-3.2.1.cjs
35 changes: 16 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"type": "module",
"exports": {
".": {
"types": "./lib/types/index.d.ts",
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js"
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
}
},
"files": [
"/lib/**/*"
],
"types": "./lib/types/index.d.ts",
"types": "./lib/index.d.ts",
"scripts": {
"build": "yarn clean && tsc -b tsconfig.build.json",
"check:packagejson": "package-check",
"clean": "rm -rfv reports coverage build dist lib .eslintcache",
"commit": "cz",
Expand All @@ -49,9 +49,6 @@
"test:mutation:ci": "yarn test:mutation",
"test:unit": "yarn test",
"test:unit:ci": "jest --silent --coverage --runInBand --ci --bail false",
"ts:build": "yarn clean && yarn ts:build:cjs && yarn ts:build:esm",
"ts:build:cjs": "tsc -b tsconfig.build.cjs.json",
"ts:build:esm": "tsc -b tsconfig.build.esm.json",
"ts:check": "tsc --noEmit"
},
"dependencies": {
Expand All @@ -65,18 +62,18 @@
"@stryker-mutator/core": "^6.0.2",
"@stryker-mutator/jest-runner": "^6.0.2",
"@stryker-mutator/typescript-checker": "^6.0.2",
"@types/jest": "^28.1.0",
"@types/node": "^17.0.39",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"@types/jest": "^28.1.2",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"commitizen": "^4.2.4",
"cspell": "^6.1.1",
"cspell": "^6.1.2",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.4.6",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-jest-formatting": "^3.1.0",
"eslint-plugin-jsdoc": "^39.3.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
Expand All @@ -87,22 +84,22 @@
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.1",
"inquirer": "^8.2.4",
"jest": "^28.1.0",
"jest": "^28.1.1",
"jest-junit": "^13.2.0",
"lint-staged": "^13.0.0",
"lint-staged": "^13.0.2",
"markdownlint-cli2": "^0.4.0",
"npm-package-json-lint": "^6.3.0",
"pinst": "^3.0.0",
"prettier": "^2.6.2",
"prettier": "^2.7.1",
"prettier-package-json": "^2.6.3",
"semantic-release": "^19.0.2",
"semantic-release": "^19.0.3",
"semantic-release-npm-github-publish": "^1.5.1",
"ts-jest": "^28.0.4",
"ts-jest": "^28.0.5",
"typescript": "^4.7.3"
},
"packageManager": "yarn@3.2.1",
"engines": {
"node": ">=16.15.1"
"node": ">=16.15"
},
"keywords": [
"management",
Expand Down
6 changes: 0 additions & 6 deletions prettier-package-json.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = {
'contributors',
'homepage',
'bugs',

/**
* Package publishing configuration
*/
Expand All @@ -24,7 +23,6 @@ module.exports = {
'repository',
'publishConfig',
'type',

/**
* Configuration
*/
Expand All @@ -42,7 +40,6 @@ module.exports = {
'config',
'sideEffects',
'typings',

/**
* Dependencies
*/
Expand All @@ -53,13 +50,11 @@ module.exports = {
'peerDependenciesMeta',
'optionalDependencies',
'devDependencies',

/**
* Yarn specific
*/
'workspaces',
'resolutions',

/**
* Constraints
*/
Expand All @@ -68,7 +63,6 @@ module.exports = {
'engineStrict',
'os',
'cpu',

/**
* Used for npm search
*/
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"packageFiles": ["package.json", ".github/workflows/**/*.yml"],
"packageRules": [
{
"packageNames": ["typescript", "rxjs", "tslib"],
"packageNames": ["typescript", "rxjs"],
"separateMinorPatch": true
}
]
Expand Down
11 changes: 0 additions & 11 deletions tsconfig.build.cjs.json

This file was deleted.

10 changes: 0 additions & 10 deletions tsconfig.build.esm.json

This file was deleted.

5 changes: 3 additions & 2 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib",
"declaration": true,
"declarationMap": true,
"declarationMap": false,
"removeComments": false,
"sourceMap": true,
"sourceMap": false,
"noEmit": false
},
"include": ["./src/**/*"]
Expand Down
1 change: 1 addition & 0 deletions tsconfig.jest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"esModuleInterop": true,
"sourceMap": true
},
"include": ["./src/**/*", "./__tests__/**/*"]
Expand Down
11 changes: 6 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"charset": "UTF-8",
"strict": true,
"alwaysStrict": true,
"newLine": "lf",
"esModuleInterop": true,
"resolveJsonModule": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": false,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"importsNotUsedAsValues": "error",
"allowJs": false,
"allowJs": true,
"checkJs": false,
"pretty": true,
"strictNullChecks": true,
Expand All @@ -26,7 +28,6 @@
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"useUnknownInCatchVariables": true,
"allowSyntheticDefaultImports": true,
"noEmit": true,
"noImplicitThis": true,
"noImplicitAny": true,
Expand Down
Loading

0 comments on commit cee8d23

Please sign in to comment.