Socket
Book a DemoInstallSign in
Socket

eslint-plugin-regularjs-beautify

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-regularjs-beautify

ESLint plugin of regularjs-beautify

0.0.10
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

eslint-plugin-regularjs-beautify

ESLint plugin for Regularjs. It can be used with the --fix option to format an entire JavaScript file which has inline Regularjs template in it.

Usage

Firstly, install this plugin on your disk:

npm install eslint-plugin-regularjs-beautify --save-dev

Secondly, enable this plugin in your eslint configuration file:

module.exports = {
  plugins: ["regularjs-beautify"],
  rules: {
    // `150` means the value of `printWith` option
    "regularjs-beautify/regularjs": ["error", 150] 
  }
};

Before we start lint, we need to add a specific flag at the top of our each template string to explicitly indicate they are under the semantics of Regularjs:

const tpl = `
<!-- @regularjs -->
<div></div>
`;

Please notice the snippet <!-- @regularjs -->, it's required to tell eslint to entre the logic of this plugin.

It maybe odd that we have to put the html comment at the top of each template, let's give it a little bit explanation. Suppose we are at the viewpoint of the plugin, there is no information for us to tell the string is a normal string or a specific one being used as Regularjs template, thus we cannot give user the exacter lint reports. So the comment is used to ask the user to indicate their intents more clearly thus to help the plugin to tell the difference between the normal string and the regularjs one.

Finally, lint your js file with the option --fix

eslint the-target-file.js --fix

Keywords

eslint

FAQs

Package last updated on 07 Apr 2020

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.