Skip to content

Commit 4c7b3e4

Browse files
author
Predrag Stojadinovic
committed
chore: cleanup
1 parent fcee135 commit 4c7b3e4

12 files changed

+5394
-2761
lines changed

.skeletest.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"srcFolderName": "src",
3+
"filesExtensions": [
4+
"ts"
5+
],
6+
"testFolderName": "test",
7+
"testFileExtensionPrefix": "spec",
8+
"testExtension": "ts",
9+
"ignoreSrcFiles": [],
10+
"ignoreTestFiles": [
11+
"test/_setup/"
12+
]
13+
}

eslint.config.cjs

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
const js = require('@eslint/js');
2+
const tseslint = require('@typescript-eslint/eslint-plugin');
3+
const tsparser = require('@typescript-eslint/parser');
4+
const prettier = require('eslint-plugin-prettier');
5+
const prettierConfig = require('eslint-config-prettier');
6+
7+
module.exports = [
8+
js.configs.recommended,
9+
{
10+
files: ['src/**/*.ts'],
11+
languageOptions: {
12+
parser: tsparser,
13+
parserOptions: {
14+
ecmaVersion: 2020,
15+
sourceType: 'module',
16+
project: './tsconfig.eslint.json',
17+
},
18+
},
19+
plugins: {
20+
'@typescript-eslint': tseslint,
21+
prettier: prettier,
22+
},
23+
rules: {
24+
// TypeScript ESLint recommended rules
25+
...tseslint.configs.recommended.rules,
26+
27+
// Prettier integration
28+
'prettier/prettier': 'error',
29+
30+
// Converted from TSLint rules
31+
'curly': ['error', 'multi-line', 'consistent'],
32+
'max-classes-per-file': ['error', 5],
33+
'@typescript-eslint/naming-convention': [
34+
'error',
35+
{
36+
selector: 'variable',
37+
format: ['camelCase', 'PascalCase'],
38+
leadingUnderscore: 'allow',
39+
},
40+
],
41+
'sort-imports': 'off', // equivalent to ordered-imports: false
42+
'sort-keys': 'off', // equivalent to object-literal-sort-keys: false
43+
44+
// Additional TypeScript-specific rules
45+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
46+
'@typescript-eslint/explicit-function-return-type': 'off',
47+
'@typescript-eslint/explicit-module-boundary-types': 'off',
48+
'@typescript-eslint/no-explicit-any': 'warn',
49+
50+
// Allow multiple variable declarations per statement (from TSLint config)
51+
'one-var': 'off',
52+
53+
// Disable some rules that might be too strict for this project
54+
'@typescript-eslint/no-inferrable-types': 'off',
55+
},
56+
},
57+
// Configuration for test files
58+
{
59+
files: ['test/**/*.ts'],
60+
languageOptions: {
61+
parser: tsparser,
62+
parserOptions: {
63+
ecmaVersion: 2020,
64+
sourceType: 'module',
65+
project: './tsconfig.eslint.json',
66+
},
67+
globals: {
68+
describe: 'readonly',
69+
it: 'readonly',
70+
test: 'readonly',
71+
expect: 'readonly',
72+
beforeAll: 'readonly',
73+
afterAll: 'readonly',
74+
beforeEach: 'readonly',
75+
afterEach: 'readonly',
76+
jest: 'readonly',
77+
},
78+
},
79+
plugins: {
80+
'@typescript-eslint': tseslint,
81+
prettier: prettier,
82+
},
83+
rules: {
84+
// TypeScript ESLint recommended rules
85+
...tseslint.configs.recommended.rules,
86+
87+
// Prettier integration
88+
'prettier/prettier': 'error',
89+
90+
// Test-specific rule overrides
91+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
92+
'@typescript-eslint/explicit-function-return-type': 'off',
93+
'@typescript-eslint/explicit-module-boundary-types': 'off',
94+
'@typescript-eslint/no-explicit-any': 'warn',
95+
'@typescript-eslint/no-unused-expressions': 'off', // Allow for Chai expressions
96+
97+
// Allow multiple variable declarations per statement
98+
'one-var': 'off',
99+
100+
// Disable some rules that might be too strict for test files
101+
'@typescript-eslint/no-inferrable-types': 'off',
102+
},
103+
},
104+
prettierConfig, // This should be last to override other formatting rules
105+
];

package.json

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,37 @@
88
"main": "./lib/prefRating.js",
99
"types": "./lib/prefRating.d.ts",
1010
"scripts": {
11-
"all": "yarn & tsc & yarn clean & yarn build & yarn test & yarn docs",
11+
"all": "pnpm install & tsc & pnpm lint:fix & pnpm build & pnpm test & pnpm docs",
1212
"build": "del /S /Q lib\\* && tsc",
1313
"build:watch": "tsc --watch",
14-
"lint": "tslint -p tsconfig.json",
15-
"clean": "tslint --config tslint-imports.json --fix --project .",
16-
"format": "prettier --write \"src/**/*.ts\"",
14+
"lint": "eslint src/**/*.ts test/**/*.ts",
15+
"lint:fix": "eslint src/**/*.ts test/**/*.ts --fix",
16+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
1717
"docs": "typedoc --readme none --out docs src",
18-
"test": "nyc mocha -r ts-node/register/transpile-only test/**/*.spec.ts",
18+
"test": "jest",
19+
"test:watch": "jest --watch",
20+
"test:coverage": "jest --coverage",
1921
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
2022
"sonar": "sonarjs -e .sonarlint/**,node_modules/**,coverage/**,.nyc_output/**",
21-
"up": "yarn upgrade-interactive",
22-
"latest": "yarn upgrade-interactive --latest"
23+
"fix": "pnpm i & pnpm dedupe & pnpm audit --fix & pnpm skeletest -f & pnpm strictr -f & pnpm format & git add test",
24+
"up": "pnpm up -i",
25+
"latest": "pnpm up -i -L",
26+
"l": "pnpm i & pnpm latest"
2327
},
2428
"files": [
2529
"lib/**/*"
2630
],
27-
"nyc": {
28-
"include": [
29-
"src/**/*.ts"
31+
"jest": {
32+
"preset": "ts-jest",
33+
"testEnvironment": "node",
34+
"roots": ["<rootDir>/src", "<rootDir>/test"],
35+
"testMatch": ["**/*.spec.ts", "**/*.test.ts"],
36+
"collectCoverageFrom": [
37+
"src/**/*.ts",
38+
"!src/**/*.d.ts"
3039
],
31-
"exclude": [
32-
"test/**/*.ts"
33-
],
34-
"extension": [
35-
".ts"
36-
],
37-
"require": [
38-
"ts-node/register/transpile-only"
39-
],
40-
"reporter": [
41-
"text-summary",
42-
"html"
43-
],
44-
"sourceMap": true,
45-
"instrument": true
40+
"coverageDirectory": "coverage",
41+
"coverageReporters": ["text-summary", "html", "lcov"]
4642
},
4743
"repository": {
4844
"type": "git",
@@ -63,24 +59,25 @@
6359
"@types/lodash": "^4.14.181",
6460
"@types/mathjs": "^9.4.2",
6561
"lodash": "^4.17.15",
66-
"mathjs": "^10.4.3"
62+
"mathjs": "^14.6.0"
6763
},
6864
"devDependencies": {
69-
"@types/chai": "^4.3.0",
70-
"@types/mocha": "^9.1.0",
71-
"chai": "^4.3.6",
65+
"@eslint/js": "^9.32.0",
66+
"@types/jest": "^30.0.0",
67+
"@typescript-eslint/eslint-plugin": "^8.38.0",
68+
"@typescript-eslint/parser": "^8.38.0",
7269
"coveralls": "^3.1.1",
73-
"mocha": "^9.2.2",
74-
"nyc": "^15.1.0",
75-
"prettier": "^2.6.2",
70+
"eslint": "^9.32.0",
71+
"eslint-config-prettier": "^10.1.8",
72+
"eslint-plugin-prettier": "^5.5.3",
73+
"jest": "^30.0.5",
74+
"prettier": "^3.6.2",
7675
"sonarjs": "^1.0.0",
7776
"source-map-support": "^0.5.21",
77+
"ts-jest": "^29.4.0",
7878
"ts-node": "^10.7.0",
79-
"tslint": "^6.1.3",
80-
"tslint-config-prettier": "^1.18.0",
81-
"tslint-etc": "^1.13.10",
82-
"tslint-no-unused-expression-chai": "^0.1.4",
83-
"typedoc": "^0.22.14",
84-
"typescript": "^4.6.3"
85-
}
79+
"typedoc": "^0.28.9",
80+
"typescript": "^5.9.2"
81+
},
82+
"packageManager": "pnpm@10.14.0"
8683
}

0 commit comments

Comments
 (0)