Skip to content

Commit 6feca83

Browse files
committed
chore: use globalThis; add prettier format
1 parent 1e60821 commit 6feca83

11 files changed

+2268
-1848
lines changed

.eslintrc.cjs

-21
This file was deleted.

.eslintrc.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
root: true,
4+
env: {
5+
browser: true,
6+
esnext: true,
7+
node: true
8+
},
9+
extends: [
10+
'eslint:recommended',
11+
'standard',
12+
'prettier/@typescript-eslint',
13+
'plugin:@typescript-eslint/recommended',
14+
'plugin:import/recommended',
15+
'plugin:prettier/recommended',
16+
'prettier'
17+
],
18+
parser: '@typescript-eslint/parser',
19+
parserOptions: {
20+
ecmaVersion: 'latest',
21+
sourceType: 'module',
22+
project: 'tsconfig.json',
23+
extraFileExtensions: []
24+
},
25+
overrides: [],
26+
plugins: ['@typescript-eslint', 'import', 'prettier'],
27+
rules: {
28+
'@typescript-eslint/consistent-type-exports': [
29+
'error',
30+
{ fixMixedExportsWithInlineTypeSpecifier: true }
31+
],
32+
'@typescript-eslint/consistent-type-imports': [
33+
'error',
34+
{ fixStyle: 'inline-type-imports' }
35+
],
36+
'@typescript-eslint/no-empty-function': 'off',
37+
'@typescript-eslint/no-empty-interface': 'off',
38+
'@typescript-eslint/no-unused-vars': 'off',
39+
'import/named': 'off',
40+
'import/newline-after-import': 'error',
41+
'import/no-unresolved': 'off',
42+
'import/order': [
43+
'error',
44+
{
45+
groups: [
46+
['builtin', 'external', 'internal'],
47+
'parent',
48+
['sibling', 'index']
49+
],
50+
'newlines-between': 'never',
51+
alphabetize: { order: 'ignore' }
52+
}
53+
],
54+
'no-console': 'warn',
55+
'no-restricted-imports': [
56+
'error',
57+
{
58+
'paths': []
59+
}
60+
],
61+
'no-useless-rename': 'error',
62+
'object-shorthand': ['error', 'always']
63+
},
64+
settings: {
65+
'import/internal-regex': '^#'
66+
},
67+
ignorePatterns: ['dist', 'node_modules', 'examples', 'scripts']
68+
}

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'npm test && publish'
1+
name: 'CI'
22

33
on:
44
push:

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'npm test && publish'
1+
name: 'Publish'
22

33
on:
44
push:

.prettierrc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"htmlWhitespaceSensitivity": "strict",
3+
"quoteProps": "preserve",
4+
"semi": false,
5+
"trailingComma": "none",
6+
"singleQuote": true
7+
}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# xid-ts
1+
# `xid-ts`
22

33
[![CI](https://github.com/yiwen-ai/xid-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/yiwen-ai/xid-ts/actions/workflows/ci.yml)
44
[![NPM version](http://img.shields.io/npm/v/xid-ts.svg)](https://www.npmjs.com/package/xid-ts)
@@ -85,4 +85,4 @@ assert.isTrue(xid.equals(Xid.fromValue(obj2.id)))
8585
## License
8686
Copyright © 2023-present [Yiwen AI](https://github.com/yiwen-ai).
8787

88-
yiwen-ai/xid-ts is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.
88+
`yiwen-ai/xid-ts` is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.

package.json

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "xid-ts",
33
"type": "module",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"author": "0xZensh <[email protected]>",
66
"description": "xid is a globally unique id generator thought for the web. A Typescript port of https://github.com/rs/xid.",
77
"license": "MIT",
@@ -37,18 +37,23 @@
3737
"clean": "rm -rf dist",
3838
"lint": "eslint .",
3939
"lint:fix": "eslint . --fix",
40+
"format": "prettier --write \"src/**/*.{json,js,jsx,ts,tsx,css,scss,svelte}\"",
41+
"ncu": "npx npm-check-updates -u",
4042
"test": "vitest src --coverage --run"
4143
},
4244
"devDependencies": {
43-
"@types/node": "^20.11.4",
44-
"@typescript-eslint/eslint-plugin": "^6.19.0",
45-
"@typescript-eslint/parser": "^6.19.0",
46-
"@vitest/coverage-v8": "^1.2.0",
47-
"cborg": "^4.0.8",
48-
"eslint": "^8.56.0",
45+
"@types/node": "^22.5.1",
46+
"@typescript-eslint/eslint-plugin": "^8.3.0",
47+
"@typescript-eslint/parser": "^8.3.0",
48+
"@vitest/coverage-v8": "^2.0.5",
49+
"cborg": "^4.2.3",
50+
"eslint": "^9.9.1",
4951
"eslint-plugin-import": "^2.29.1",
50-
"typescript": "^5.3.3",
51-
"vitest": "^1.2.0"
52+
"eslint-config-prettier": "^9.1.0",
53+
"eslint-plugin-prettier": "^5.2.1",
54+
"prettier": "^3.3.3",
55+
"typescript": "^5.5.4",
56+
"vitest": "^2.0.5"
5257
},
5358
"dependencies": {},
5459
"keywords": [

0 commit comments

Comments
 (0)