Skip to content

Commit 80c4b7c

Browse files
authored
chore: update lint config (#58)
* chore: update lint config * lint * update
1 parent 504ccf4 commit 80c4b7c

21 files changed

Lines changed: 3202 additions & 318 deletions

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- 'v*'
77

88
jobs:
99
release:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ node_modules
22
.DS_Store
33
dist
44
*.log
5-
/types.ts
65
output.css

.vscode/settings.json

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
{
2-
"editor.formatOnSave": true,
3-
"editor.defaultFormatter": "esbenp.prettier-vscode",
4-
"eslint.experimental.useFlatConfig": true
2+
// Disable the default formatter, use eslint instead
3+
"prettier.enable": false,
4+
"editor.formatOnSave": false,
5+
6+
// Auto fix
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": "explicit",
9+
"source.organizeImports": "never"
10+
},
11+
12+
// Silent the stylistic rules in your IDE, but still auto fix them
13+
"eslint.rules.customizations": [
14+
{ "rule": "style/*", "severity": "off", "fixable": true },
15+
{ "rule": "format/*", "severity": "off", "fixable": true },
16+
{ "rule": "*-indent", "severity": "off", "fixable": true },
17+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
18+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
19+
{ "rule": "*-order", "severity": "off", "fixable": true },
20+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
21+
{ "rule": "*-newline", "severity": "off", "fixable": true },
22+
{ "rule": "*quotes", "severity": "off", "fixable": true },
23+
{ "rule": "*semi", "severity": "off", "fixable": true }
24+
],
25+
26+
// Enable eslint for all supported languages
27+
"eslint.validate": [
28+
"javascript",
29+
"javascriptreact",
30+
"typescript",
31+
"typescriptreact",
32+
"vue",
33+
"html",
34+
"markdown",
35+
"json",
36+
"jsonc",
37+
"yaml",
38+
"toml",
39+
"xml",
40+
"gql",
41+
"graphql",
42+
"astro",
43+
"svelte",
44+
"css",
45+
"less",
46+
"scss",
47+
"pcss",
48+
"postcss"
49+
]
550
}

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
**💛 You can help the author become a full-time open-source maintainer by [sponsoring him on GitHub](https://github.com/sponsors/egoist).**
22

3-
---
3+
- - -
44

55
# @egoist/tailwindcss-icons
66

7-
> Use any icon from [Iconify](https://iconify.design/)
7+
> Use any icon from [Iconify](https://iconify.design)
88
99
[![npm version](https://badgen.net/npm/v/@egoist/tailwindcss-icons)](https://npm.im/@egoist/tailwindcss-icons) [![npm downloads](https://badgen.net/npm/dm/@egoist/tailwindcss-icons)](https://npm.im/@egoist/tailwindcss-icons)
1010

1111
<img src="https://user-images.githubusercontent.com/8784712/219618866-e5632d23-b948-4fa1-b3d6-00581a704bca.png" alt="preview" width="700" />
1212

1313
## Install
1414

15-
```bash
15+
```sh
1616
npm i @egoist/tailwindcss-icons -D
1717
```
1818

@@ -38,16 +38,16 @@ With js config:
3838
In your `tailwind.config.ts`:
3939

4040
```ts
41-
import type { Config } from "tailwindcss"
42-
import { iconsPlugin, getIconCollections } from "@egoist/tailwindcss-icons"
41+
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons'
42+
import type { Config } from 'tailwindcss'
4343

4444
export default {
4545
plugins: [
4646
iconsPlugin({
4747
// Select the icon collections you want to use
4848
// You can also ignore this option to automatically discover all individual icon packages you have installed
4949
// If you install @iconify/json, you should explicitly specify the collections you want to use, like this:
50-
collections: getIconCollections(["mdi", "lucide"]),
50+
collections: getIconCollections(['mdi', 'lucide']),
5151
// If you want to use all icons from @iconify/json, you can do this:
5252
// collections: getIconCollections("all"),
5353
// and the more recommended way is to use `dynamicIconsPlugin`, see below.
@@ -58,7 +58,7 @@ export default {
5858

5959
You also need to install `@iconify/json` (full icon collections, 50MB) or `@iconify-json/{collection_name}` (individual icon package):
6060

61-
```bash
61+
```sh
6262
# install every icon:
6363
npm i @iconify/json -D
6464

@@ -93,16 +93,16 @@ Search the icon you want to use here: https://icones.js.org
9393
You can also use custom icons with this plugin, for example:
9494

9595
```ts
96-
import type { Config } from "tailwindcss"
97-
import { iconsPlugin } from "@egoist/tailwindcss-icons"
96+
import { iconsPlugin } from '@egoist/tailwindcss-icons'
97+
import type { Config } from 'tailwindcss'
9898

9999
export default {
100100
plugins: [
101101
iconsPlugin({
102102
collections: {
103103
foo: {
104104
icons: {
105-
"arrow-left": {
105+
'arrow-left': {
106106
// svg body
107107
body: '<path d="M10 19l-7-7m0 0l7-7m-7 7h18"/>',
108108
// svg width and height, optional
@@ -134,8 +134,8 @@ This is because we can not provide autocomplete for all icons from `@iconify/jso
134134
it will make your editor slow.
135135

136136
```ts
137-
import type { Config } from "tailwindcss"
138-
import { iconsPlugin, dynamicIconsPlugin } from "@egoist/tailwindcss-icons"
137+
import { dynamicIconsPlugin, iconsPlugin } from '@egoist/tailwindcss-icons'
138+
import type { Config } from 'tailwindcss'
139139

140140
export default {
141141
plugins: [iconsPlugin(), dynamicIconsPlugin()],

eslint-suppressions.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"src/core.ts": {
3+
"node/prefer-global/process": {
4+
"count": 2
5+
},
6+
"regexp/no-super-linear-backtracking": {
7+
"count": 2
8+
}
9+
},
10+
"src/utils.ts": {
11+
"@typescript-eslint/no-unused-expressions": {
12+
"count": 1
13+
},
14+
"prefer-regex-literals": {
15+
"count": 1
16+
},
17+
"regexp/no-dupe-disjunctions": {
18+
"count": 1
19+
},
20+
"regexp/no-unused-capturing-group": {
21+
"count": 2
22+
},
23+
"ts/no-unused-expressions": {
24+
"count": 1
25+
},
26+
"unicorn/error-message": {
27+
"count": 2
28+
}
29+
}
30+
}

eslint.config.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
// @ts-check
1+
import { defineConfig } from 'eslint-config-hyoban'
22

3-
import eslint from "@eslint/js"
4-
import { defineConfig } from "eslint/config"
5-
import tseslint from "typescript-eslint"
6-
7-
export default defineConfig(
8-
eslint.configs.recommended,
9-
tseslint.configs.recommended,
10-
{
11-
ignores: ["dist", "example"],
12-
},
13-
)
3+
export default defineConfig()

example/tailwind.config.cjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ const {
22
iconsPlugin,
33
dynamicIconsPlugin,
44
getIconCollections,
5-
} = require("../dist/index.cjs");
5+
} = require('../dist/index.cjs')
66

77
module.exports = {
8-
content: ["./index.html"],
8+
content: ['./index.html'],
99
plugins: [
1010
iconsPlugin({
1111
scale: 10,
1212
strokeWidth: 1,
13-
collections: getIconCollections(["lucide", "tabler"]),
13+
collections: getIconCollections(['lucide', 'tabler']),
1414
}),
1515
dynamicIconsPlugin({ scale: 10 }),
1616
],
17-
};
17+
}

gen-types.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
// @ts-check
2-
import fs from "fs"
3-
import { createRequire } from "module"
2+
import fs from 'node:fs'
3+
import { createRequire } from 'node:module'
44

55
const req = createRequire(import.meta.url)
6-
const collections = req("@iconify/json/collections.json")
6+
const collections = req('@iconify/json/collections.json')
77

88
fs.writeFileSync(
9-
"types.ts",
10-
`export const collectionNames = [${Object.keys(collections)
11-
.map((v) => JSON.stringify(v))
12-
.join(", ")}] as const
13-
/** All the available icon collections when you have \`@iconify/json\` installed */\nexport type CollectionNames = typeof collectionNames[number]
9+
'types.ts',
10+
`export const collectionNames = [
11+
${Object.keys(collections)
12+
.sort()
13+
.map(v => JSON.stringify(v))
14+
.join(', ')}
15+
] as const
16+
/** All the available icon collections when you have \`@iconify/json\` installed */
17+
export type CollectionNames = typeof collectionNames[number]
1418
`,
1519
)

package.json

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"name": "@egoist/tailwindcss-icons",
3+
"type": "module",
34
"version": "1.9.2",
5+
"packageManager": "[email protected]",
46
"description": "Icons utility for TailwindCSS",
57
"publishConfig": {
68
"access": "public"
79
},
8-
"type": "module",
10+
"license": "MIT",
911
"repository": {
1012
"type": "git",
1113
"url": "git+https://github.com/hyoban/tailwindcss-icons.git"
1214
},
13-
"files": [
14-
"dist"
15-
],
1615
"exports": {
1716
".": {
17+
"types": "./dist/index.d.ts",
1818
"import": {
1919
"types": "./dist/index.d.ts",
2020
"default": "./dist/index.js"
@@ -23,48 +23,54 @@
2323
"types": "./dist/index.d.cts",
2424
"default": "./dist/index.cjs"
2525
},
26-
"types": "./dist/index.d.ts",
2726
"default": "./dist/index.js"
2827
}
2928
},
3029
"main": "./dist/index.cjs",
3130
"module": "./dist/index.js",
3231
"types": "./dist/index.d.ts",
32+
"files": [
33+
"dist"
34+
],
3335
"scripts": {
34-
"prepare": "pnpm run gen-types",
35-
"gen-types": "node ./gen-types.mjs",
36+
"prepare": "simple-git-hooks",
37+
"gen-types": "node ./gen-types.mjs && eslint --fix ./types.ts",
3638
"build-fast": "pnpm gen-types && tsup src/index.ts --format cjs,esm",
3739
"build": "pnpm run build-fast --dts-resolve",
3840
"prepublishOnly": "pnpm run build",
3941
"test": "vitest run",
40-
"format": "prettier --write .",
41-
"format:check": "prettier --check .",
42-
"lint": "eslint --max-warnings 0 .",
42+
"lint": "eslint --max-warnings 0",
43+
"lint:fix": "eslint --max-warnings 0 --fix",
4344
"typecheck": "tsc --noEmit"
4445
},
45-
"license": "MIT",
46-
"packageManager": "[email protected]",
46+
"peerDependencies": {
47+
"tailwindcss": "*"
48+
},
49+
"dependencies": {
50+
"@iconify/utils": "^3.1.0"
51+
},
4752
"devDependencies": {
48-
"@eslint/js": "^9.39.2",
4953
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
5054
"@iconify-json/heroicons": "^1.2.3",
5155
"@iconify/json": "^2.2.433",
5256
"@iconify/types": "^2.0.0",
5357
"@types/node": "^25.1.0",
5458
"eslint": "^9.39.2",
59+
"eslint-config-hyoban": "6.0.0-beta.3",
60+
"lint-staged": "^16.2.7",
5561
"postcss": "^8.5.6",
5662
"prettier": "^3.8.1",
5763
"prettier-plugin-tailwindcss": "^0.7.2",
64+
"simple-git-hooks": "^2.13.1",
5865
"tailwindcss": "^3.4.19",
5966
"tsup": "^8.5.1",
6067
"typescript": "^5.9.3",
61-
"typescript-eslint": "^8.54.0",
6268
"vitest": "^4.0.18"
6369
},
64-
"dependencies": {
65-
"@iconify/utils": "^3.1.0"
70+
"simple-git-hooks": {
71+
"pre-commit": "pnpm lint-staged"
6672
},
67-
"peerDependencies": {
68-
"tailwindcss": "*"
73+
"lint-staged": {
74+
"*": "eslint --fix"
6975
}
7076
}

0 commit comments

Comments
 (0)