Migrate to bun and eslint.
This commit is contained in:
parent
8418b242c3
commit
4a9f582ad8
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
*.sw?
|
*.sw?
|
||||||
|
.lvimrc
|
||||||
|
54
eslint.config.mjs
Normal file
54
eslint.config.mjs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import importPlugin from 'eslint-plugin-import'
|
||||||
|
import tsParser from '@typescript-eslint/parser'
|
||||||
|
import eslintJs from '@eslint/js'
|
||||||
|
import eslintTs from 'typescript-eslint'
|
||||||
|
|
||||||
|
const tsFiles = ['src/**/*.ts']
|
||||||
|
|
||||||
|
const customTypescriptConfig = {
|
||||||
|
files: tsFiles,
|
||||||
|
plugins: {
|
||||||
|
import: importPlugin,
|
||||||
|
'import/parsers': tsParser,
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
parserOptions: {
|
||||||
|
project: './tsconfig.json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
'import/parsers': {
|
||||||
|
'@typescript-eslint/parser': ['.ts'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'linebreak-style': ['error', 'unix'],
|
||||||
|
quotes: ['error', 'single', { avoidEscape: true }],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const recommendedTypeScriptConfigs = [
|
||||||
|
...eslintTs.configs.recommended.map((config) => ({
|
||||||
|
...config,
|
||||||
|
files: tsFiles,
|
||||||
|
})),
|
||||||
|
...eslintTs.configs.stylistic.map((config) => ({
|
||||||
|
...config,
|
||||||
|
files: tsFiles,
|
||||||
|
})),
|
||||||
|
]
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'docs/*',
|
||||||
|
'build/*',
|
||||||
|
'lib/*',
|
||||||
|
'dist/*',
|
||||||
|
],
|
||||||
|
}, // global ignores
|
||||||
|
eslintJs.configs.recommended,
|
||||||
|
...recommendedTypeScriptConfigs,
|
||||||
|
customTypescriptConfig,
|
||||||
|
]
|
29
package-lock.json
generated
29
package-lock.json
generated
@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@jdbernard/logging",
|
|
||||||
"version": "1.1.5",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "@jdbernard/logging",
|
|
||||||
"version": "1.1.4",
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "^5.0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/typescript": {
|
|
||||||
"version": "5.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
|
||||||
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
|
||||||
"tsc": "bin/tsc",
|
|
||||||
"tsserver": "bin/tsserver"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12.20"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,7 +9,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"prepare": "npm run build",
|
"prepare": "bun run build",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -23,6 +23,9 @@
|
|||||||
"author": "Jonathan Bernard",
|
"author": "Jonathan Bernard",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.0.4"
|
"@typescript-eslint/parser": "^8.19.0",
|
||||||
|
"eslint-plugin-import": "^2.31.0",
|
||||||
|
"typescript": "^5.0.4",
|
||||||
|
"typescript-eslint": "^8.19.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es6",
|
"target": "es2016",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user