|
1 | 1 | # 🎨 Next.js CSS Linter
|
| 2 | +A tool for seamless work with CSS modules in Next.js and React. |
2 | 3 |
|
3 |
| -A tool for analyzing CSS modules in Next.js projects. The linter detects **unused classes** in styles and **references to non-existent classes** in `.tsx` files. |
4 |
| - |
5 |
| -## 🔹 Features |
6 |
| -- Project-wide analysis with warnings displayed in the editor |
7 |
| -- High performance thanks to Rust-based implementation |
8 |
| -- Support for `import aliases` from `tsconfig.json` |
9 |
| -- Ability to ignore specific warnings |
10 |
| -- Find definitions for your CSS classes |
| 4 | +## 🔹 Key Features |
| 5 | +- Detects unused CSS classes |
| 6 | +- Finds undefined classes in `.tsx` files |
| 7 | +- Enables quick navigation to CSS class definitions |
| 8 | +- Provides autocomplete suggestions for CSS classes |
| 9 | +- Displays CSS class content on hover |
| 10 | +- Automatically extracts inline styles into CSS modules |
11 | 11 |
|
12 | 12 | ## 🔹 Usage
|
13 |
| -Linting runs automatically **on file save**, and warnings are displayed in the workspace. |
| 13 | +Linting runs **on file save**, and warnings are displayed in the editor. |
| 14 | + |
| 15 | +### ✂️ Extracting Inline Styles |
| 16 | +1. Select the `style={{}}` prop in a JSX/TSX file. |
| 17 | +2. Open the context menu and choose **"Extract inline styles into CSS module"**. |
| 18 | +3. Select the CSS module where the styles should be moved. |
| 19 | +4. Enter a name for the new CSS class and press **Enter**. |
| 20 | +5. The inline styles will be converted into a CSS class and added to the selected module. |
14 | 21 |
|
15 |
| -### 🔹 Ignoring Warnings |
16 |
| -If a class is used correctly but still marked as unused, add a comment **directly above the class declaration**: |
| 22 | +## 🔹 Ignoring Warnings |
| 23 | +If a class is used correctly but still marked as unused, add a comment **above its declaration**: |
17 | 24 | ```css
|
18 | 25 | /* css-lint-disable-rule unused-class */
|
19 | 26 | ```
|
20 |
| -Alternatively, use the **Quick Fix** feature available in the editor. |
| 27 | +Alternatively, use the **Quick Fix** feature available in the editor. |
21 | 28 |
|
22 |
| ---- |
23 |
| -**by AndcoolSystems, 04 March, 2025** |
| 29 | +--- |
| 30 | +📌 **by AndcoolSystems, March 4, 2025** |
0 commit comments