Files
lucide/eslint.config.js
T
4b3f93d9d0 feat(@lucide/solid): Support for Solid 2.0 RC (#4751)
* Updates needed to support Solid 2

* Switch to the next tag

* feat(packages): add `@lucide/solid` package for Solid 2

Solid 2's API is a breaking change from Solid 1 and is still an RC, so
`lucide-solid` stays on Solid 1 (`solid-js: ^1.4.7`) untouched and Solid 2
support ships as a new `packages/solid` package named `@lucide/solid` —
the same scheme already used by `@lucide/svelte` and `@lucide/angular`.

The package is a copy of `lucide-solid` on the `@lucide/shared` build
architecture, ported to Solid 2:

- `splitProps` -> `omit`, `solid-js/web` -> `@solidjs/web`,
  `JSXElement` -> `Element`, `Context.Provider` -> `<Context value>`
- `jsxImportSource` is `@solidjs/web` in tsconfig, the esbuild step and
  `ts.createProgram`; rollup externals drop the removed `solid-js/store`
- `vite-plugin-solid` -> `@solidjs/vite-plugin`
- tests keep upstream's coverage with two Solid 2 adaptations: boolean
  attribute literals must be strings (`aria-hidden="false"`), and writes
  are batched so the reactivity tests need a `flush()` before asserting

Rendered output is unchanged — the snapshots are byte-identical to
`lucide-solid`'s.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(solid): fix React leftovers in the Solid guide

The Solid guide was derived from the React guide and three things were
not carried across:

- `advanced/typescript.md` still told readers the types are for "a
  TypeScript React project"
- its `LucideIcon` example kept React's destructured-props signature.
  The `: ButtonProps` annotation had also been dropped in the copy, so
  `ButtonProps` was declared but unused and the parameters were
  implicitly `any`. Destructuring props breaks reactivity in Solid —
  verified: with `({ icon: Icon, label })` a changing `label` never
  reaches the DOM, while `props.label` updates correctly.
- `advanced/aliased-names.md` had an orphaned `###` heading; its parent
  `## Choosing import name style` was dropped during the conversion
  because it documents React-only subpath exports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs: type the shared Sandpack wrapper with `SandpackProps`

The base Sandpack wrapper declared its props as
`FunctionalComponent<LucideProps>` with `LucideProps` imported from
`@lucide/vue`, which has nothing to do with a Sandpack embed. None of
the props the markdown plugin actually passes (`template`, `files`,
`options`, `customSetup`, `theme`) were declared, so they only reached
the inner `<Sandpack />` via Vue's fallthrough attributes.

Declare `SandpackProps` from `sandpack-vue3` instead and forward them
explicitly. This also removes the `@lucide/vue` import that made every
framework guide — including the Solid one, which uses this wrapper
directly — appear to reference the Vue package.

Verified with a full `vitepress build`: each framework guide's chunk
still carries its own template (react/vue/vite-svelte/vanilla/
vite-solid) and all five props reach the component.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(solid): document the Solid 2 flavour in the getting started guide

The Solid guide teaches `lucide-solid` throughout (64 references), so
the one-line note about `@lucide/solid` left Solid 2 readers on a page
whose every install command and live example is Solid 1 — and the
packages list points `@lucide/solid` at this same page.

Replace that note with a "Using Solid 2?" callout holding its own
tabbed install group, the import-specifier swap, and a table of the
Solid 2 changes that affect code written around Lucide (`@solidjs/web`,
`jsxImportSource`, `splitProps` -> `omit`, `<Ctx value>`), linking out
to Solid's own migration guide for the rest.

The claim that both packages expose the same components and props is
checked, not assumed: `dist/types/lucide-solid.d.ts` is identical
between the two packages, and the only differences anywhere in the
public type surface are Solid's own renames (the `JSX` namespace source
and `JSXElement` -> `Element`).

Keeps one guide section for both packages, matching how upstream
handles the two Svelte packages.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(solid): port lucide-solid to Solid 2

- Icon/context/types use Solid 2 APIs: omit() instead of splitProps(),
  Dynamic and JSX types from @solidjs/web.
- solid-js / @solidjs/web 2.0 (rc) as peer and dev dependencies,
  babel-preset-solid 2; rollup and tsconfig updated to match.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Add integration test

* Update rollup file

* Fix tests

* Revert lucide-solid changes

* update lockfile

* Fix docs

* Format code

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Eric <eric.fennis@gmail.com>
2026-10-02 19:02:20 +02:00

156 lines
4.7 KiB
JavaScript

import path from 'node:path';
import js from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import { defineConfig } from 'eslint/config';
import prettier from 'eslint-config-prettier';
import importX, { createNodeResolver } from 'eslint-plugin-import-x';
import htmlEslint from '@html-eslint/eslint-plugin';
import htmlParser from '@html-eslint/parser';
import defaultAttrs from './tools/build-icons/render/default-attrs.json' with { type: 'json' };
import tseslint from 'typescript-eslint';
const gitignorePath = path.join(import.meta.dirname, '.gitignore');
export default defineConfig([
tseslint.configs.recommended,
{
// `packages/angular` has its own config with its own tsconfig, so a single `eslint .` run sees
// two candidate roots and typescript-eslint refuses to guess between them.
languageOptions: {
parserOptions: {
tsconfigRootDir: import.meta.dirname,
},
},
},
// Everything git ignores (generated icon sources, build output, caches) is ignored here too.
includeIgnoreFile(gitignorePath),
{
// Ignores that are not in .gitignore, because these files are committed.
ignores: [
'lib',
'**/tests',
'packages/**/tests/*',
'docs/images',
'docs/**/examples/',
'docs/.vitepress/theme/components/editors/preact/index.js',
'packages/svelte/.svelte-kit',
'integrations/**/file-routes.d.ts',
// Tracked in git despite matching a .gitignore pattern, so lint it.
'!packages/lucide-react/dynamicIconImports.mjs',
],
},
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
global: 'readonly',
__dirname: 'readonly',
},
},
plugins: {
'import-x': importX,
},
settings: {
'import-x/resolver-next': [createNodeResolver()],
},
rules: {
...js.configs.recommended.rules,
...prettier.rules,
'no-console': 'off',
'no-param-reassign': 'off',
'no-shadow': 'off',
'no-use-before-define': 'off',
'import-x/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.test.js',
'**/*.spec.js',
'**/scripts/**',
'eslint.config.js',
'packages/**/tests/**',
],
},
],
'import-x/extensions': [
'error',
{
pattern: {
mjs: 'always',
json: 'always',
},
},
],
},
},
{
rules: {
// Omitting a property by destructuring it away (`const { key, ...attrs } = node`) leaves the
// omitted binding unused on purpose, so don't report it.
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
},
},
{
files: ['./icons/*.svg'],
languageOptions: {
parser: htmlParser,
},
plugins: {
'@html-eslint': htmlEslint,
},
rules: {
'@html-eslint/require-doctype': 'off',
'@html-eslint/no-duplicate-attrs': 'error',
'@html-eslint/no-inline-styles': 'error',
'@html-eslint/require-attrs': [
'error',
...Object.entries(defaultAttrs).map(([attr, value]) => ({
tag: 'svg',
attr,
value: String(value),
})),
],
'@html-eslint/indent': ['error', 2],
'@html-eslint/no-multiple-empty-lines': ['error', { max: 0 }],
'@html-eslint/no-extra-spacing-attrs': [
'error',
{
enforceBeforeSelfClose: true,
},
],
'@html-eslint/attrs-newline': [
'error',
{
inline: ['path', 'line', 'polyline', 'polygon', 'rect', 'circle', 'ellipse'],
},
],
'@html-eslint/require-closing-tags': [
'error',
{
selfClosing: 'always',
// Inside <svg> every tag counts as "foreign", where the rule only checks that a tag
// already written `/>` stays that way. Listing the shapes here is what actually forces
// `<path ...></path>` to become `<path ... />`.
selfClosingCustomPatterns: ['^(path|line|polyline|polygon|rect|circle|ellipse)$'],
},
],
'@html-eslint/no-restricted-attr-values': [
'error',
{
attrPatterns: ['^(fill|stroke)$'],
attrValuePatterns: ['^(?!(none|currentColor)$).*$'],
message:
'Icons must inherit their colors: `fill` and `stroke` may only be `none` or `currentColor`.',
},
],
'@html-eslint/element-newline': 'error',
'@html-eslint/no-trailing-spaces': 'error',
'@html-eslint/quotes': 'error',
},
},
]);