Skip to content

Commit e893f66

Browse files
committed
update dotfiles, configs, scripts, etc
1 parent df3cd2b commit e893f66

File tree

11 files changed

+2415
-4400
lines changed

11 files changed

+2415
-4400
lines changed

.eslintrc.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = {
2-
root: true,
32
parser: '@typescript-eslint/parser',
43
plugins: ['@typescript-eslint', 'eslint-plugin', 'import', 'jest', 'prettier'],
54
env: {
@@ -8,13 +7,12 @@ module.exports = {
87
},
98
extends: [
109
'eslint:recommended',
11-
'plugin:import/errors',
12-
'plugin:import/warnings',
10+
'plugin:import/recommended',
1311
'plugin:eslint-plugin/all',
1412
'plugin:prettier/recommended',
1513
],
1614
parserOptions: {
17-
ecmaVersion: 10,
15+
ecmaVersion: '2024',
1816
sourceType: 'module',
1917
},
2018
rules: {
@@ -28,7 +26,7 @@ module.exports = {
2826
rules: {
2927
'@typescript-eslint/explicit-function-return-type': 'off',
3028
'@typescript-eslint/explicit-module-boundary-types': 'off',
31-
'@typescript-eslint/ban-ts-ignore': 'off',
29+
'@typescript-eslint/ban-ts-comment': 'off',
3230
'@typescript-eslint/no-explicit-any': 'off',
3331
},
3432

@@ -52,17 +50,16 @@ module.exports = {
5250
'jest/prefer-to-have-length': 'warn',
5351
'jest/prefer-spy-on': 'error',
5452
'jest/valid-expect': 'error',
55-
'jest/no-test-callback': 'off',
53+
'jest/no-done-callback': 'off',
5654
},
5755
},
5856
],
5957
},
6058
],
6159
settings: {
6260
'import/resolver': {
63-
node: {
64-
moduleDirectory: ['node_modules', 'src'],
65-
},
61+
node: true,
62+
typescript: true,
6663
},
6764
},
6865
}

.github/workflows/publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ jobs:
1414
- uses: actions/checkout@v2
1515
- uses: actions/setup-node@v1
1616
with:
17-
node-version: 18
17+
node-version: 20
1818
- run: yarn
1919
- run: yarn verify
20+
env:
21+
MINIFY: true
2022

2123
publish-npm:
2224
needs: build
@@ -25,9 +27,10 @@ jobs:
2527
- uses: actions/checkout@v2
2628
- uses: actions/setup-node@v1
2729
with:
28-
node-version: 18
30+
node-version: 20
2931
registry-url: https://registry.npmjs.org/
3032
- run: yarn
3133
- run: npm publish
3234
env:
3335
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
36+
MINIFY: true

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: [16.x, 18.x, 20.x]
18+
node-version: [18.x, 20.x]
1919

2020
steps:
2121
- uses: actions/checkout@v2

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ module.exports = {
33
trailingComma: 'all',
44
arrowParens: 'avoid',
55
semi: false,
6+
singleQuote: true,
67
}

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
# eslint-plugin-typescript-sort-keys
44

5-
Sort interface and string enum keys
5+
Sort interface and enum keys
66

77
Inspired by and sourced from [eslint/sort-keys]([https://github.com/eslint/eslint/blob/master/docs/rules/sort-keys.md](https://github.com/eslint/eslint/blob/main/docs/src/rules/sort-keys.md))
88

99
## Installation
1010

11+
Supported on Node 18+
12+
1113
You'll first need to install
1214

1315
- [eslint](http://eslint.org)
@@ -50,7 +52,7 @@ Then configure the rules you want to use under the rules section.
5052
{
5153
"rules": {
5254
"typescript-sort-keys/interface": "error",
53-
"typescript-sort-keys/string-enum": "error"
55+
"typescript-sort-keys/enum": "error"
5456
}
5557
}
5658
```
@@ -67,12 +69,13 @@ Or enable all rules with defaults
6769

6870
<!-- begin rule list -->
6971

70-
**Key**: :heavy_check_mark: = recommended, :wrench: = fixable
72+
**Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :warning: = deprecated
7173

7274
<!-- prettier-ignore -->
73-
| Name | Description | :heavy_check_mark: | :wrench: |
75+
| Name | Description | | |
7476
| ---- | ----------- | ------------------ | -------- |
7577
| [`typescript-sort-keys/interface`](./docs/rules/interface.md) | require interface keys to be sorted | :heavy_check_mark: | :wrench: |
76-
| [`typescript-sort-keys/string-enum`](./docs/rules/string-enum.md) | require string enum members to be sorted | :heavy_check_mark: | :wrench: |
78+
| [`typescript-sort-keys/enum`](./docs/rules/enum.md) | require enum members to be sorted | :heavy_check_mark: | :wrench: |
79+
| [`typescript-sort-keys/string-enum`](./docs/rules/string-enum.md) | (**DEPRECATED**) require string enum members to be sorted | :warning: | :wrench: |
7780

7881
<!-- end rule list -->

jest.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
module.exports = {
2-
testRegex: 'tests/.*\\.spec\\.(js|ts)$',
2+
coverageDirectory: 'coverage',
3+
collectCoverageFrom: ['src/**/*'],
4+
coverageReporters: [['text', { skipFull: false, skipEmpty: true }], 'lcov'],
5+
coverageThreshold: {
6+
global: {
7+
branches: 94,
8+
functions: 100,
9+
lines: 100,
10+
statements: 98,
11+
},
12+
},
313
moduleDirectories: ['node_modules', 'src'],
14+
randomize: true, // Just to be sure memoization isn't broken
15+
testRegex: 'tests/.*\\.spec\\.(js|ts)$',
416
}

package.json

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"files": [
1616
"/lib",
1717
"package.json",
18-
"CHANGELOG.md",
1918
"LICENSE.md",
2019
"README.md"
2120
],
@@ -28,69 +27,87 @@
2827
"./package.json": "./package.json"
2928
},
3029
"scripts": {
31-
"prepublishOnly": "yarn compile",
3230
"build": "yarn rimraf lib && yarn compile",
3331
"compile": "yarn rollup -c",
34-
"docs": "eslint-docs",
32+
"coverage-preview": "http-server -o -p 5000 coverage/lcov-report",
33+
"deduplicate": "yarn-deduplicate --strategy fewer",
3534
"docs:check": "eslint-docs check",
36-
"lint": "eslint --ext .js,.ts src/ tests/",
35+
"docs": "eslint-docs",
3736
"format": "prettier --write src/**/*.{js,ts} tests/**/*.{js,ts}",
38-
"test": "yarn jest --watch",
39-
"coverage": "yarn test --coverage --watchAll=false",
40-
"coverage-preview": "http-server -o -p 5000 coverage/lcov-report",
37+
"lint": "eslint --ext .js,.ts src/ tests/",
38+
"prepublishOnly": "MINIFY=1 yarn build",
39+
"purge": "yarn -s rimraf node_modules lib",
40+
"test:autofix": "yarn -s jest ./tests/autofix.spec.ts",
41+
"test:config": "yarn -s jest ./tests/config.spec.ts",
42+
"test:interface": "yarn -s jest ./tests/rules/interface/*.spec.ts",
43+
"test:rules": "yarn -s jest ./tests/rules/*/*.spec.ts --collectCoverage=true",
44+
"test:enum": "yarn -s jest ./tests/rules/enum/*.spec.ts",
45+
"test:watch:autofix": "yarn jest --watch ./tests/autofix.spec.ts",
46+
"test:watch:config": "yarn jest --watch ./tests/config.spec.ts",
47+
"test:watch:interface": "yarn jest --watch ./tests/rules/interface/*.spec.ts",
48+
"test:watch:rules": "yarn jest --watch ./tests/rules/*/*.spec.ts",
49+
"test:watch:enum": "yarn jest --watch ./tests/rules/enum/*.spec.ts",
50+
"test:watch": "yarn -s jest --watch .*.spec.ts",
51+
"test": "yarn -s jest .*.spec.ts --collectCoverage=true",
4152
"typecheck": "tsc --noEmit --skipLibCheck",
42-
"verify": "yarn typecheck && yarn lint && yarn build && yarn coverage"
53+
"verify": "yarn typecheck && yarn lint && yarn build && yarn test"
4354
},
4455
"dependencies": {
45-
"@typescript-eslint/experimental-utils": "^5.0.0",
56+
"@typescript-eslint/utils": "^6.7.4",
4657
"json-schema": "^0.4.0",
4758
"natural-compare-lite": "^1.4.0"
4859
},
4960
"devDependencies": {
50-
"@babel/cli": "~7.14.8",
51-
"@babel/core": "~7.15.0",
52-
"@babel/preset-env": "~7.15.0",
53-
"@babel/preset-typescript": "~7.15.0",
61+
"@babel/cli": "~7.23.0",
62+
"@babel/core": "~7.23.0",
63+
"@babel/preset-env": "~7.23.0",
64+
"@babel/preset-typescript": "~7.23.0",
5465
"@infctr/eslint-docs": "~0.4.0",
55-
"@rollup/plugin-commonjs": "~12.0.0",
56-
"@rollup/plugin-json": "~4.0.3",
57-
"@rollup/plugin-node-resolve": "~8.0.0",
58-
"@rollup/plugin-typescript": "~11.1.2",
59-
"@types/babel__core": "~7.1.7",
60-
"@types/babel__preset-env": "~7.9.0",
61-
"@types/eslint": "~7.28.1",
62-
"@types/jest": "~27.0.2",
66+
"@rollup/plugin-commonjs": "~25.0.5",
67+
"@rollup/plugin-json": "~6.0.1",
68+
"@rollup/plugin-node-resolve": "~15.2.2",
69+
"@rollup/plugin-terser": "~0.4.4",
70+
"@rollup/plugin-typescript": "~11.1.4",
71+
"@types/eslint": "~8.44.3",
72+
"@types/jest": "~29.5.5",
6373
"@types/natural-compare-lite": "~1.4.0",
64-
"@types/rimraf": "~3.0.1",
65-
"@types/tmp": "~0.2.1",
66-
"@typescript-eslint/eslint-plugin": "~6.4.0",
67-
"@typescript-eslint/parser": "~6.4.0",
68-
"babel-jest": "~26.6.3",
69-
"babel-plugin-module-resolver": "~4.1.0",
70-
"eslint": "~8.0.1",
74+
"@types/node": "^18.0.0",
75+
"@types/tmp": "~0.2.4",
76+
"@typescript-eslint/eslint-plugin": "^6.7.4",
77+
"@typescript-eslint/parser": "^6.7.4",
78+
"babel-jest": "~29.7.0",
79+
"babel-plugin-module-resolver": "~5.0.0",
80+
"chalk": "~5.3.0",
81+
"eslint": "~8.50.0",
7182
"eslint-config-prettier": "~9.0.0",
83+
"eslint-import-resolver-typescript": "~3.6.1",
7284
"eslint-plugin-eslint-plugin": "~5.1.1",
73-
"eslint-plugin-import": "~2.28.0",
74-
"eslint-plugin-jest": "~27.2.3",
85+
"eslint-plugin-import": "~2.28.1",
86+
"eslint-plugin-jest": "~27.4.2",
7587
"eslint-plugin-prettier": "~5.0.0",
76-
"http-server": "~13.0.0",
88+
"http-server": "^14.0.0",
7789
"husky": "~4.2.5",
78-
"jest": "~29.6.2",
79-
"lint-staged": "~10.5.4",
80-
"prettier": "3.0.1",
81-
"rimraf": "~3.0.2",
82-
"rollup": "~2.10.5",
90+
"jest": "~29.7.0",
91+
"lint-staged": "^14.0.1",
92+
"lorem-ipsum": "~2.0.8",
93+
"prettier": "^3.1.0",
94+
"rimraf": "^5.0.5",
95+
"rollup": "~4.7.0",
8396
"tmp": "~0.2.1",
84-
"tsconfig": "~7.0.0",
85-
"typescript": "5.1.6"
97+
"typescript": "~5.2.2",
98+
"yarn-deduplicate": "^6.0.2"
8699
},
87100
"peerDependencies": {
88101
"@typescript-eslint/parser": "^6",
89102
"eslint": "^7 || ^8",
90103
"typescript": "^3 || ^4 || ^5"
91104
},
92105
"engines": {
93-
"node": ">= 16"
106+
"node": ">=18"
107+
},
108+
"volta": {
109+
"node": "18.19.0",
110+
"yarn": "1.22.19"
94111
},
95112
"license": "ISC"
96113
}

rollup.config.js

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

rollup.config.mjs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import commonjs from '@rollup/plugin-commonjs'
2+
import json from '@rollup/plugin-json'
3+
import resolve from '@rollup/plugin-node-resolve'
4+
import terser from '@rollup/plugin-terser'
5+
import typescript from '@rollup/plugin-typescript'
6+
import assert from 'assert'
7+
import fs from 'fs'
8+
import path from 'path'
9+
10+
const minify = !!process.env.MINIFY
11+
12+
const config = JSON.parse(fs.readFileSync('./tsconfig.json', 'utf-8'))
13+
assert(config)
14+
const baseUrl = config.compilerOptions.baseUrl
15+
16+
const internalFolders = fs
17+
.readdirSync(baseUrl, { withFileTypes: true })
18+
.filter(dir => dir.isDirectory())
19+
.map(dir => path.resolve(process.cwd(), baseUrl, dir.name))
20+
21+
const isExternal = id =>
22+
!id.startsWith('.') &&
23+
!id.startsWith('/') &&
24+
!id.startsWith('\0') &&
25+
!internalFolders.some(mapping => id.startsWith(mapping))
26+
27+
export default [
28+
{
29+
input: './src/index.ts',
30+
external: isExternal,
31+
output: [
32+
{
33+
dir: 'lib',
34+
entryFileNames: '[name].cjs.js',
35+
format: 'cjs',
36+
},
37+
{
38+
dir: 'lib',
39+
entryFileNames: '[name].mjs',
40+
format: 'es',
41+
},
42+
],
43+
plugins: [commonjs(), resolve(), typescript(), json(), minify && terser()],
44+
},
45+
]

0 commit comments

Comments
 (0)