Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 4, 2024
1 parent e0735a4 commit 2510cc5
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 63 deletions.
39 changes: 15 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export default {

<br></details>


<details>
<summary>Webpack</summary><br>

Expand Down Expand Up @@ -315,7 +314,7 @@ export default {
compiler: 'jsx',
jsx: 'react'
})
)
)

return config
}
Expand All @@ -340,7 +339,6 @@ See [the Next.js example](examples/next) for a working example project.

<br></details>


<details>
<summary>esbuild</summary><br>

Expand Down Expand Up @@ -387,7 +385,6 @@ See [the Astro example](examples/astro) for a working example project.

###### Frameworks


<details>
<summary>Vue 3 / Vue 2.7+</summary><br>

Expand Down Expand Up @@ -420,7 +417,6 @@ See [the Vue 3 example](examples/vite-vue3) for a working example project.

<br></details>


<details>
<summary>Vue 2 (only for versions < 2.7)</summary><br>

Expand All @@ -440,7 +436,7 @@ Type Declarations

```jsonc
// tsconfig.json
{
{
"compilerOptions": {
"types": [
"unplugin-icons/types/vue",
Expand Down Expand Up @@ -472,7 +468,7 @@ Type Declarations

```jsonc
// tsconfig.json
{
{
"compilerOptions": {
"types": [
"unplugin-icons/types/react",
Expand All @@ -485,7 +481,6 @@ See [the React example](examples/vite-react) for a working example project.

<br></details>


<details>
<summary>Preact</summary><br>

Expand All @@ -505,7 +500,7 @@ Type Declarations

```jsonc
// tsconfig.json
{
{
"compilerOptions": {
"types": [
"unplugin-icons/types/preact",
Expand All @@ -518,11 +513,9 @@ See [the Preact example](examples/vite-preact) for a working example project.

<br></details>


<details>
<summary>Solid</summary><br>


```ts
Icons({ compiler: 'solid' })
```
Expand All @@ -549,7 +542,6 @@ See [the Solid example](examples/vite-solid) for a working example project.
<details>
<summary>Svelte</summary><br>


```ts
Icons({ compiler: 'svelte' })
```
Expand Down Expand Up @@ -590,7 +582,7 @@ Type Declarations

```jsonc
// tsconfig.json
{
{
"compilerOptions": {
"types": [
"unplugin-icons/types/astro",
Expand Down Expand Up @@ -631,7 +623,7 @@ Type Declarations

```jsonc
// tsconfig.json
{
{
"compilerOptions": {
"types": [
"unplugin-icons/types/qwik",
Expand Down Expand Up @@ -721,7 +713,7 @@ import IconBar from '~icons/my-yet-other-icons/bar'
### Use with Resolver

When using with resolvers for auto-importing, you will need to tell it your custom collection names:
When using resolvers for auto-importing, you will need to tell it your custom collection names:

```ts
IconResolver({
Expand Down Expand Up @@ -758,23 +750,22 @@ IconResolver({
})
```


You can also combine it with `FileSystemIconLoader` or with other custom icon loaders:
```ts
// loader helpers
import { ExternalPackageIconLoader, FileSystemIconLoader } from 'unplugin-icons/loaders'

Icons({
Icons({
customCollections: {
...ExternalPackageIconLoader('an-awesome-collection'),
...ExternalPackageIconLoader('@my-awesome-collections/some-collection'),
...ExternalPackageIconLoader('@my-awesome-collections/some-other-collection'),
'my-yet-other-icons': FileSystemIconLoader(
'./assets/icons',
'./assets/icons',
svg => svg.replace(/^<svg /, '<svg fill="currentColor" '),
),
},
)
})
```

See the [Vue 3 + Vite example](./examples/vite-vue3/vite.config.ts).
Expand All @@ -783,9 +774,9 @@ See the [Vue 3 + Vite example](./examples/vite-vue3/vite.config.ts).

From `v0.13` you can also customize each icon using `iconCustomizer` configuration option or using query params when importing them.

The `query` param will take precedence over `iconCustomizer` and `iconCustomizer` over `configuration`.
The `query` param will take precedence over `iconCustomizer` and `iconCustomizer` over `configuration`.

The `iconCustomizer` and `query` params will be applied to any collection, that is, for each icon from `custom` loader, `inlined` on `customCollections` or from `@iconify`.
The `iconCustomizer` and `query` params will be applied to any collection, that is, for each icon from `custom` loader, `inlined` on `customCollections` or from `@iconify`.

For example, you can configure `iconCustomizer` to change all icons for a collection or individual icons on a collection:

Expand Down Expand Up @@ -934,7 +925,7 @@ export default {
## Options

You can set default styling for all icons.
You can set default styling for all icons.
The following config shows the default values of each option:

```ts
Expand Down Expand Up @@ -1077,7 +1068,7 @@ IconsResolver({

### Collection Aliases

When using component resolver, you have to use the name of the collection that can be long or redundant: for example,
When using component resolver, you have to use the name of the collection that can be long or redundant: for example,
when using `icon-park` collection you need to use it like this `<icon-icon-park-abnormal />`.

You can add an alias for any collection to the `IconResolver` plugin:
Expand All @@ -1094,7 +1085,7 @@ IconsResolver({

You can use the alias or the collection name, the plugin will resolve both.

Following with the example and configuring the plugin with previous `alias` entry, you can now use
Following with the example and configuring the plugin with previous `alias` entry, you can now use
`<icon-park-abnormal />` or `<icon-icon-park-abnormal />`.

## Sponsors
Expand Down
20 changes: 10 additions & 10 deletions examples/vite-vue3/@test-scope/test-color-icons/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type {
IconifyJSON,
IconifyInfo,
IconifyMetaData,
IconifyChars,
} from '@iconify/types';
IconifyChars,
IconifyInfo,
IconifyJSON,
IconifyMetaData,
} from '@iconify/types'

export { IconifyJSON, IconifyInfo, IconifyMetaData, IconifyChars };
export { IconifyJSON, IconifyInfo, IconifyMetaData, IconifyChars }

export declare const icons: IconifyJSON;
export declare const info: IconifyInfo;
export declare const metadata: IconifyMetaData;
export declare const chars: IconifyChars;
export declare const icons: IconifyJSON
export declare const info: IconifyInfo
export declare const metadata: IconifyMetaData
export declare const chars: IconifyChars
12 changes: 6 additions & 6 deletions examples/vite-vue3/@test-scope/test-color-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@test-scope/test-color-icons",
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts",
"exports": {
"./*": "./*",
".": {
"require": "./index.js",
"import": "./index.mjs"
"import": "./index.mjs",
"require": "./index.js"
}
}
},
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts"
}
20 changes: 10 additions & 10 deletions examples/vite-vue3/plain-color-icons/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type {
IconifyJSON,
IconifyInfo,
IconifyMetaData,
IconifyChars,
} from '@iconify/types';
IconifyChars,
IconifyInfo,
IconifyJSON,
IconifyMetaData,
} from '@iconify/types'

export { IconifyJSON, IconifyInfo, IconifyMetaData, IconifyChars };
export { IconifyJSON, IconifyInfo, IconifyMetaData, IconifyChars }

export declare const icons: IconifyJSON;
export declare const info: IconifyInfo;
export declare const metadata: IconifyMetaData;
export declare const chars: IconifyChars;
export declare const icons: IconifyJSON
export declare const info: IconifyInfo
export declare const metadata: IconifyMetaData
export declare const chars: IconifyChars
13 changes: 6 additions & 7 deletions examples/vite-vue3/plain-color-icons/index.mjs
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
// eslint-disable-next-line style/comma-dangle
const icons = {
prefix: 'plain-color-icons',
icons: {
about: {
body: '<path fill="#2196F3" d="M37 40H11l-6 6V12c0-3.3 2.7-6 6-6h26c3.3 0 6 2.7 6 6v22c0 3.3-2.7 6-6 6z"/><g fill="#fff"><path d="M22 20h4v11h-4z"/><circle cx="24" cy="15" r="2"/></g>'
}
body: '<path fill="#2196F3" d="M37 40H11l-6 6V12c0-3.3 2.7-6 6-6h26c3.3 0 6 2.7 6 6v22c0 3.3-2.7 6-6 6z"/><g fill="#fff"><path d="M22 20h4v11h-4z"/><circle cx="24" cy="15" r="2"/></g>',
},
},
lastModified: 1672652184,
width: 48,
height: 48
height: 48,
}

const info = {
prefix: 'test-color-icons',
name: 'Test Color Icons',
total: 1,
author: {
name: 'test'
name: 'test',
},
license: {
title: 'MIT'
title: 'MIT',
},
samples: ['about'],
height: 32,
displayHeight: 16
displayHeight: 16,
}

const metadata = {}
Expand Down
12 changes: 6 additions & 6 deletions examples/vite-vue3/plain-color-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "plain-color-icons",
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts",
"exports": {
"./*": "./*",
".": {
"require": "./index.js",
"import": "./index.mjs"
"import": "./index.mjs",
"require": "./index.js"
}
}
},
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts"
}

0 comments on commit 2510cc5

Please sign in to comment.