Skip to content

Commit ebfc722

Browse files
Modernize @tsdotnet/array-init: Update to ESLint v9, dual module output, modern build system
1 parent 558f622 commit ebfc722

File tree

10 files changed

+114
-2397
lines changed

10 files changed

+114
-2397
lines changed

.eslintrc.json

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

dist-esm/arrayInit.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

dist/arrayInit.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/arrayInit.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import js from '@eslint/js';
2+
import tsEslint from 'typescript-eslint';
3+
4+
export default [
5+
js.configs.recommended,
6+
...tsEslint.configs.recommended,
7+
{
8+
ignores: [
9+
"dist/",
10+
"dist-esm/",
11+
"docs/",
12+
"tests/",
13+
"node_modules/"
14+
]
15+
},
16+
{
17+
files: ["**/*.ts"],
18+
rules: {
19+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
20+
}
21+
}
22+
];

package.json

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
"license": "MIT",
77
"types": "dist/arrayInit.d.ts",
88
"main": "dist/arrayInit.js",
9-
"module": "dist-esm/arrayInit.js",
9+
"module": "dist-esm/arrayInit.mjs",
10+
"exports": {
11+
"import": "./dist-esm/arrayInit.mjs",
12+
"require": "./dist/arrayInit.js"
13+
},
1014
"keywords": [
1115
"array",
1216
"array helper",
@@ -15,18 +19,16 @@
1519
"array initialization"
1620
],
1721
"scripts": {
18-
"build:dist": "rimraf dist && tsc && copyfiles -u 1 src/**/*.d.ts dist",
19-
"build:dist-esm": "rimraf dist-esm && tsc -p tsconfig.esm.json",
20-
"build": "pnpm i && pnpm run build:dist && pnpm run build:dist-esm",
21-
"bump": "npm run-script precommit && npm version patch",
22+
"build:cjs": "rimraf dist && tsc && copyfiles -u 1 src/**/*.d.ts dist",
23+
"build:esm": "rimraf dist-esm && tsc -p tsconfig.esm.json && node -e \"const fs=require('fs'),path=require('path'),dir='dist-esm';fs.readdirSync(dir).forEach(file=>{if(path.extname(file)==='.js'){const old=path.join(dir,file),newer=path.join(dir,file.replace('.js','.mjs'));fs.renameSync(old,newer)}})\"",
24+
"build": "concurrently pnpm:build:cjs pnpm:build:esm",
2225
"docs": "rimraf docs && typedoc --options typedoc.json --readme none",
2326
"lint": "eslint src/**/*.ts",
24-
"precommit": "pnpm i && run-p lint test && run-p build:* && npm run-script validate && git status -s",
25-
"prepublishOnly": "npm run-script build && run-p validate test",
26-
"preversion": "run-p lint test",
27-
"postversion": "git push && git push --tags && npm run-script docs && git add -A && git commit -m \"Updated docs.\" docs && git push",
28-
"test": "mocha -r ts-node/register tests/**/*.ts",
29-
"validate": "node ./.build/validate-package.js"
27+
"precommit": "concurrently pnpm:lint pnpm:test && pnpm run build",
28+
"prepublishOnly": "pnpm run build && pnpm test",
29+
"preversion": "concurrently pnpm:lint pnpm:test",
30+
"postversion": "git push && git push --tags && pnpm run docs && git add -A && git commit -m \"Updated docs.\" docs && git push",
31+
"test": "mocha -r ts-node/register tests/**/*.ts"
3032
},
3133
"repository": {
3234
"type": "git",
@@ -37,25 +39,20 @@
3739
},
3840
"homepage": "https://github.com/tsdotnet/array-init#readme",
3941
"devDependencies": {
42+
"@eslint/js": "^9.33.0",
4043
"@types/chai": "^5.2.2",
4144
"@types/mocha": "^10.0.10",
4245
"@types/node": "^24.3.0",
43-
"@typescript-eslint/eslint-plugin": "^8.39.1",
44-
"@typescript-eslint/parser": "^8.39.1",
4546
"chai": "^5.2.1",
47+
"concurrently": "^9.2.0",
4648
"copyfiles": "^2.4.1",
4749
"eslint": "^9.33.0",
48-
"eslint-config-typescript": "^3.0.0",
49-
"eslint-plugin-import": "^2.32.0",
50-
"eslint-plugin-node": "^11.1.0",
51-
"eslint-plugin-promise": "^7.2.1",
5250
"mocha": "^11.7.1",
53-
"npm-run-all": "^4.1.5",
54-
"nyc": "^17.1.0",
5551
"rimraf": "^6.0.1",
5652
"ts-node": "^10.9.2",
5753
"typedoc": "^0.28.10",
58-
"typescript": "^5.9.2"
54+
"typescript": "^5.9.2",
55+
"typescript-eslint": "^8.39.1"
5956
},
6057
"pnpm": {
6158
"overrides": {

0 commit comments

Comments
 (0)