Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import eslint from '@eslint/js';
import configPrettier from 'eslint-config-prettier';
import configTurbo from 'eslint-config-turbo/flat';
import pluginTreeShaking from '@clerk/eslint-plugin-tree-shaking';
import pluginImport from 'eslint-plugin-import';
import pluginJest from 'eslint-plugin-jest';
import pluginJsDoc from 'eslint-plugin-jsdoc';
Expand Down Expand Up @@ -406,6 +407,14 @@ export default tseslint.config([
'@typescript-eslint/no-floating-promises': 'warn',
},
},
{
name: 'packages/react',
files: ['packages/react/src/**/*'],
...pluginTreeShaking.configs.recommended,
rules: {
'tree-shaking/no-side-effects-in-initialization': 'warn',
},
},
{
name: 'repo/integration',
...pluginPlaywright.configs['flat/recommended'],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@changesets/cli": "^2.29.4",
"@changesets/get-github-info": "^0.6.0",
"@clerk/backend": "workspace:*",
"@clerk/eslint-plugin-tree-shaking": "workspace:*",
"@clerk/shared": "workspace:*",
"@clerk/testing": "workspace:*",
"@commitlint/cli": "^19.8.0",
Expand Down
22 changes: 22 additions & 0 deletions packages/eslint-plugin-tree-shaking/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2022 Clerk, Inc.
Copyright (c) 2016 Lukas Taegert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
18 changes: 18 additions & 0 deletions packages/eslint-plugin-tree-shaking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<p align="center">
<a href="https://clerk.com?utm_source=github&utm_medium=clerk_types" target="_blank" rel="noopener noreferrer">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://images.clerk.com/static/logo-dark-mode-400x400.png">
<img src="https://images.clerk.com/static/logo-light-mode-400x400.png" height="64">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add alt text to image for accessibility.

The Clerk logo image is missing alt text, which is important for screen readers and accessibility compliance.

Apply this diff to add appropriate alt text:

-      <img src="https://images.clerk.com/static/logo-light-mode-400x400.png" height="64">
+      <img alt="Clerk Logo" src="https://images.clerk.com/static/logo-light-mode-400x400.png" height="64">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<img src="https://images.clerk.com/static/logo-light-mode-400x400.png" height="64">
<img alt="Clerk Logo" src="https://images.clerk.com/static/logo-light-mode-400x400.png" height="64">
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

5-5: Images should have alternate text (alt text)

(MD045, no-alt-text)

🤖 Prompt for AI Agents
packages/eslint-plugin-tree-shaking/README.md around line 5: the img tag for the
Clerk logo is missing alt text; update the tag to include an appropriate alt
attribute (e.g., alt="Clerk logo" or alt="Clerk logo (light mode)") so screen
readers can describe the image and improve accessibility.

</picture>
</a>
<br />
<h1 align="center">@clerk/eslint-plugin-tree-shaking</h1>
</p>

---

## License and Credits

This project is licensed under the **MIT license**, and is a fork of the [`eslint-plugin-tree-shaking`](https://github.com/lukastaegert/eslint-plugin-tree-shaking) library written by Lukas Taegert.

See [LICENSE](https://github.com/clerk/javascript/blob/main/packages/eslint-plugin-tree-shaking/LICENSE) for more information.
20 changes: 20 additions & 0 deletions packages/eslint-plugin-tree-shaking/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@clerk/eslint-plugin-tree-shaking",
"version": "0.0.1",
"private": true,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"build": "tsc"
},
"devDependencies": {
"@types/estree": "^1.0.8",
"@types/estree-jsx": "^1.0.5",
"eslint": "9.31.0"
}
}
21 changes: 21 additions & 0 deletions packages/eslint-plugin-tree-shaking/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { ESLint } from 'eslint';
import { noSideEffectsInInitialization } from './rules/no-side-effects-in-initialization.js';

const plugin: ESLint.Plugin = {
meta: {
name: 'tree-shaking',
},
configs: {},
rules: {
'no-side-effects-in-initialization': noSideEffectsInInitialization,
},
};

Object.assign((plugin.configs ??= {}), {
recommended: {
plugins: { 'tree-shaking': plugin },
rules: { 'tree-shaking/no-side-effects-in-initialization': 'error' },
},
});

export default plugin;
Loading
Loading