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

@x.render/render-lint

v1.1.2

Published

A lintflow, a one-stop code verification environment setup that supports ESLint, Stylelint, Prettier, and Commitlint.

Downloads

729

Readme

render-lint

中文文档

Introduce

A lintflow, a one-stop code verification environment setup that supports ESLint, Stylelint, Prettier, and Commitlint.

there is no need for cumbersome configuration, and various verification tools are ready to use out of the box, which reduces complicated configuration and improves the time for project engineering to take shape.

Usage

npm i @x.render/render-lint -D

After installing render-lint, there is no need to separately install eslint, stylelint, prettier, husky and other tools, it can be used directly out of the box.

command

After installing render-lint, the terminal can use the following commands to automatically generate various rule verifications.

npx render-lint init

using the force parameter will force the relevant configuration files to be generated in the root directory of your project.

npx render-lint init --force

Configuration

The configuration file format supported by render-lint is: .render-lint.(ts|js|json). If you do not use a configuration file, render-lint will use the default configuration file .render-lint.ts.

the configuration of type means using the specified type of verification rule set, for example: common-ts, common, react-ts, react

Default configuration

The content in the default configuration file is as follows

import { LintConfig } from "@x.render/render-lint";
const lintConfig: LintConfig = {
  eslint: {
    type: "common",
  },
  stylelint: {
    type: "common",
  },
  commitlint: {
    type: "common",
  },
};
export default lintConfig;

the above configuration indicates using eslint, stylelint, and commitlint to verify project code.

Use js configuration file

Create a new .render-lint.js file in the root directory of the project and write the following content.

module.exports = {
  eslint: {
    type: "common",
  },
  commitlint: {
    type: "common",
  },
  prettier: {
    type: "common",
  },
  stylelint: {
    type: "common",
  },
};

Use json configuration file

Create a new .render-lint.json file in the root directory of the project and write the following content.

{
  "eslint": {
    "type": "common"
  },
  "commitlint": {
    "type": "common"
  },
  "prettier": {
    "type": "common"
  },
  "stylelint": {
    "type": "common"
  }
}

The render-lint scaffolding will implement on-demand configuration based on the configuration in the configuration file. The following configuration will only generate eslint-related configurations.

import { LintConfig } from "@x.render/render-lint";
const lintConfig: LintConfig = {
  eslint: {
    type: "common",
  },
};
export default lintConfig;

you can use different configurations based on the actual situation of your project.

Lint tool files

After the init command is executed, render-lint will generate some files based on the configuration. These files can be used to verify the code style, commit information format verification, etc.

Eslint configuration file

Add the .eslintrc.js file in the project root directory.

const { getESLintConfig } = require("@x.render/render-lint");

module.exports = getESLintConfig("common", {
  // Custom rules have a higher priority than the internal rules in render-lint.
});

currently getESLintConfig supports the acquisition of four rule sets: common-ts, common, react-ts, and react.

Stylelint configuration file

Add the .stylelintrc.js file in the project root directory.

const { getStylelintConfig } = require("@x.render/render-lint");

module.exports = getStylelintConfig("react", {
  // Custom rules have a higher priority than the internal rules in render-lint.
});

currently, getStylelintConfig supports the acquisition of common and react rule sets.

Prettier configuration file

Add the .prettierrc.js file in the project root directory.

const { getPrettierConfig } = require("@x.render/render-lint");

module.exports = getPrettierConfig("react", {
  // Custom rules have a higher priority than the internal rules in render-lint.
});

currently, getPrettierConfig supports the acquisition of common and react rule sets.

Commitlint configuration file

Add the commitlint.config.js file in the project root directory.

const { getCommitlintConfig } = require("@x.render/render-lint");

module.exports = getCommitlintConfig("react", {
  // Custom rules have a higher priority than the internal rules in render-lint.
});

currently, getCommitlintConfig supports the acquisition of common and react rule sets.

Q&A

  • Q1: I want to use eslint to check react projects written in typescript. How to configure it?

    • A1: You can configure the following in your render-lint configuration file:
    import { LintConfig } from "@x.render/render-lint";
    const lintConfig: LintConfig = {
      eslint: {
        type: "react-ts",
      },
    };
    export default lintConfig;

    then run the render-lint init command to obtain the corresponding rule set

    • A2: You can also actively obtain the relevant rule sets when generating the eslint configuration file.
    const { getESLintConfig } = require("@x.render/render-lint");
    
    module.exports = getESLintConfig("react-ts", {
      // Custom rules have a higher priority than the internal rules in render-lint.
    });
    • Q2: The internal rules in render-lint do not meet my current needs. How should I use custom configuration?
    • A1: Here is an example of modifying the configuration of eslint:
    const { getESLintConfig } = require("@x.render/render-lint");
    
    module.exports = getESLintConfig("react-ts", {
      // Custom rules have a higher priority than the internal rules in render-lint.
      rules: {
        "no-console": "off",
        "@typescript-eslint/no-unused-vars": "off",
      },
    });

    In short, how did you modify the configuration of eslint, stylelint, etc. before? If you modify it like this now, render-lint does not do other magic things.