🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-jimu-theme

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-jimu-theme

This plug-in is used to assist in migrating jimu-theme variables to the new version.

2.1.0
latest
npm
Version published
Maintainers
1
Created
Source

eslint-plugin-jimu-theme

This plug-in is used to assist in migrating jimu-theme variables to the new version.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-jimu-theme:

npm install eslint-plugin-jimu-theme --save-dev

Usage

Add jimu-theme to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "jimu-theme"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "jimu-theme/rule-name": 2
    }
}

Note

This plugin is only for assisting in jimu-theme upgrades and should not be used for other purposes.

The no-classic-* rules are used to upgrade corresponding variables, for example:

theme.colors.primary => theme.sys.color.primary.main

Rule no-classic-variables contains all other rules prefixed with no-classic (except rule no-classic-css-utilities, no-classic-css-vars), so you can choose to replace them with rule no-classic-variables.

The rule no-unnecessary-template-vars is intended to clean up abnormal code after a theme upgrade, such as:

~~const style = `color: ${'transparent'};`~~

const style = `color: transparent;`

The rule no-unnecessary-template-vars need to be placed after no-classic-*.

Then put rule no-classic-variables-left after all rules to check whether any classic theme variables are not recognized.

Furthermore, after automatic fixing, there might still be incorrect code remaining, which requires reviewing each file individually.

For example:

Before fixing:

const colors = theme.colors
const primary = colors.primary

After fixing:

const colors = theme.colors
const primary = theme.sys.color.primary.main

You can see that after the fix, a variable named "theme" is missing, and the definition of the "colors" variable is no longer needed. These require further manual processing. If you perform global automatic fixing, you need to pay attention to the warning and error messages eslint prints on the console to complete this part of the manual fixing.

We recommend autofixing files one by one rather than applying a global autofix directly.

Rules

🔧 Automatically fixable by the --fix CLI option.

Name                        Description🔧
no-classic-borderThis rule facilitates the deprecation of border variables in the classic theme and provides automatic fixes to replace these border variables with variables from the new theme or fallback values.🔧
no-classic-border-radiusThis rule facilitates the deprecation of borderRadiuses variables in the classic theme and provides automatic fixes to replace these borderRadiuses variables with variables from the new theme or fallback values.🔧
no-classic-colorsThis rule updates colors variables from old classic theme to new theme.🔧
no-classic-css-utilitiesThis rule facilitates the upgrade of css utilities from the classic theme to the new theme.🔧
no-classic-css-varsThis rule facilitates the transition of CSS variables representing colors from the classic theme to the new theme.🔧
no-classic-dark-themeThis rule facilitates the deprecation of darkTheme variables in the classic theme and provides automatic fixes to replace it with variables from the new theme.🔧
no-classic-elementsThis rule facilitates the deprecation of elements(e.g header, footer, body, link) variables in the classic theme and provides automatic fixes to replace these elements variables with variables from the new theme or fallback values.🔧
no-classic-focused-stylesThis rule facilitates the deprecation of focusedStyles variables in the classic theme and provides automatic fixes to replace these focusedStyles variables with variables from the new theme or fallback values.🔧
no-classic-shadowThis rule facilitates the deprecation of boxShadows variables in the classic theme and provides automatic fixes to replace these boxShadows variables with variables from the new theme.🔧
no-classic-sizesThis rule facilitates the deprecation of sizes variables in the classic theme and provides automatic fixes to replace these sizes variables with variables from the new theme.🔧
no-classic-surfaceThis rule facilitates the deprecation of surfaces variables in the classic theme and provides automatic fixes to replace these border variables with variables from the new theme or fallback values.🔧
no-classic-typographyThis rule facilitates the deprecation of typography variables in the classic theme and provides automatic fixes to replace these typography variables with variables from the new theme or fallback values.🔧
no-classic-variablesThis rule updates variables from old classic theme to new theme.🔧
no-classic-variables-leftThis rule is to check whether there are any remaining classical variables.🔧
no-guttersThis rule facilitates the deprecation of gutters variables in the theme and provides automatic fixes to replace these gutter variables with specific values.🔧
no-ref-paletteThis rule is used to check whether a theme ref palette variable is being used.🔧
no-ref-palette-css-varsThis rule is used to check whether a theme ref palette css vars is being used.🔧
no-unnecessary-template-varsRemove unnecessary template string variables. Note: If it is used for theme upgrade, this rule should be called after other rules for upgrading the theme to fix abnormal results caused by the upgrade.🔧

Keywords

eslint

FAQs

Package last updated on 03 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts