Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-react-data-attr

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react-data-attr

ESLint rules for data attribute of React's JSX

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
372
increased by48.8%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-react-data-attr

npm version

ESLint rules for data attribute of React's JSX.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-react-data-attr:

$ npm install eslint-plugin-react-data-attr --save-dev

Usage

Add react-data-attr to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

module.exports = {
  plugins: ['react-data-attr'],
};

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

module.exports = {
  rules: {
    'react-data-attr/deny-upper-case': 2,
  },
};

Supported Rules

This plugin currently supports 1 rule.

Rule: deny-upper-case

Detects that uppercase letters are used in the data attribute name.

Examples of incorrect code for this rule:

const Foo = () => {
  return <div data-attrName="value">bar</div>;
};

Examples of correct code for this rule:

const Foo = () => {
  return <div data-attr-name="value">bar</div>;
};
Options

Example:

module.exports = {
  rules: {
    'react-data-attr/deny-upper-case': [
      2,
      {
        excludeSourceFilePatterns: [
          '\\.test\\.(jsx|tsx)$', // Ignore filenames ending in `.test.jsx` or `.test.tsx`
          '\\.stories\\.(jsx|tsx)$',
          '\\.foo', // Ignore filenames containing `.foo`
        ],
      },
    ],
  },
};
Property NameDescriptionDefault Value
excludeSourceFilePatternsAn array of RegExp patterns. File paths that match any pattern are excluded from the check.here

Licence

MIT

Keywords

FAQs

Package last updated on 09 Jun 2021

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc