npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-jimu-theme

v2.1.0-beta.2

Published

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

Downloads

1,878

Readme

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-border | This 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-radius | This 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-colors | This rule updates colors variables from old classic theme to new theme. | 🔧 | | no-classic-css-utilities | This rule facilitates the upgrade of css utilities from the classic theme to the new theme. | 🔧 | | no-classic-css-vars | This rule facilitates the transition of CSS variables representing colors from the classic theme to the new theme. | 🔧 | | no-classic-dark-theme | This 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-elements | This 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-styles | This 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-shadow | This 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-sizes | This 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-surface | This 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-typography | This 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-variables | This rule updates variables from old classic theme to new theme. | 🔧 | | no-classic-variables-left | This rule is to check whether there are any remaining classical variables. | 🔧 | | no-gutters | This rule facilitates the deprecation of gutters variables in the theme and provides automatic fixes to replace these gutter variables with specific values. | 🔧 | | no-unnecessary-template-vars | Remove 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. | 🔧 |