Skip to content

Commit

Permalink
Use biome
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo Gravity committed Apr 2, 2024
1 parent 5e5070f commit 82b09e1
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 160 deletions.
31 changes: 0 additions & 31 deletions .editorconfig

This file was deleted.

5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions .eslintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,3 @@ jobs:
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup .npmrc file to publish to GitHub Packages
uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@tomchen'
- run: npm run addscope
- name: Publish to GitHub Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.idea/
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/commit-msg

This file was deleted.

8 changes: 0 additions & 8 deletions .husky/common.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/pre-commit

This file was deleted.

21 changes: 21 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"lineWidth": 120
},
"linter": {
"enabled": true,
"rules": {
"suspicious": {
"noImplicitAnyLet": "off",
"noExplicitAny": "off"
},
"recommended": true
}
}
}
1 change: 0 additions & 1 deletion commitlint.config.js

This file was deleted.

7 changes: 0 additions & 7 deletions config/tsconfig.umd.json

This file was deleted.

30 changes: 0 additions & 30 deletions config/webpack.config.js

This file was deleted.

24 changes: 10 additions & 14 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
module.exports = {
roots: ['<rootDir>/test'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)',
],
roots: ["<rootDir>/test"],
testMatch: ["**/__tests__/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'./config/fileTransformer.js',
"^.+\\.(ts|tsx)$": ["ts-jest", { tsConfig: "tsconfig.json", diagnostics: { exclude: ["**"] } }],
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"./config/fileTransformer.js",
},
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json'
}
}
}
testEnvironment: "node",
moduleNameMapper: {
electron: "<rootDir>/__mocks__/electron.js",
},
};
37 changes: 11 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@
"description": "",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"umd:main": "dist/umd/index.js",
"types": "dist/types/index.d.js",
"scripts": {
"postinstall": "husky install",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable",
"prepublishOnly": "npm run clean && npm run test && npm run lint && npm run build",
"build": "npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types",
"build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json",
"build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json",
"build:umd": "node tools/cleanup umd && webpack --config config/webpack.config.js",
"build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
"clean": "node tools/cleanup",
"package": "npm run build && npm pack",
"format": "npx @biomejs/biome format src --write && npx @biomejs/biome format test --write",
"lint": "npx @biomejs/biome lint src && npx @biomejs/biome lint test",
"lint:check": "npx @biomejs/biome check --apply-unsafe src && npx @biomejs/biome check --apply-unsafe test",
"test": "jest --no-cache --runInBand",
"test:cov": "jest --coverage --no-cache --runInBand",
"addscope": "node tools/packagejson name @tomchen/example-typescript-package"
"test:cov": "jest --coverage --no-cache --runInBand"
},
"publishConfig": {
"access": "public"
Expand All @@ -37,8 +35,7 @@
"starter",
"demo",
"cjs",
"esm",
"umd"
"esm"
],
"author": "Tom Chen <[email protected]>",
"license": "MIT",
Expand All @@ -52,22 +49,10 @@
},
"dependencies": {},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.2",
"jest": "^27.2.0",
"pinst": "^2.1.6",
"prettier": "^2.4.0",
"ts-jest": "^27.0.5",
"ts-loader": "^9.2.5",
"typescript": "^4.4.3",
"webpack": "^5.52.1",
"webpack-cli": "^4.8.0"
"@biomejs/biome": "1.6.3",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.4.3"
}
}
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
// "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
"lib": ["ES2022"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
Expand All @@ -26,7 +26,7 @@

/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
Expand Down Expand Up @@ -64,7 +64,7 @@
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
// "skipLibCheck": true, /* Skip type checking of declaration files. */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"include": ["src/**/*"]
Expand Down

0 comments on commit 82b09e1

Please sign in to comment.