Socket
Socket
Sign inDemoInstall

eslint-plugin-jest-dom

Package Overview
Dependencies
167
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.1.1 to 5.2.0

57

dist/index.js

@@ -7,4 +7,5 @@ "use strict";

});
exports.rules = exports.generateRecommendedConfig = exports.generateAllRulesConfig = exports.configs = void 0;
exports.rules = exports.default = exports.configs = void 0;
var _requireindex = _interopRequireDefault(require("requireindex"));
var _package = require("../package.json");
/**

@@ -23,13 +24,6 @@ * @fileoverview lint rules for use with jest-dom

// import all rules in src/rules
// import all rules in src/rules and re-export them for .eslintrc configs
const rules = exports.rules = (0, _requireindex.default)(`${__dirname}/rules`);
const generateRecommendedConfig = allRules => Object.entries(allRules).reduce((memo, [name, rule]) => ({
const allRules = Object.entries(rules).reduce((memo, [name]) => ({
...memo,
...(rule.meta.docs.recommended ? {
[`jest-dom/${name}`]: "error"
} : {})
}), {});
exports.generateRecommendedConfig = generateRecommendedConfig;
const generateAllRulesConfig = allRules => Object.entries(allRules).reduce((memo, [name]) => ({
...memo,
...{

@@ -39,12 +33,35 @@ [`jest-dom/${name}`]: "error"

}), {});
exports.generateAllRulesConfig = generateAllRulesConfig;
const configs = exports.configs = {
recommended: {
plugins: ["jest-dom"],
rules: generateRecommendedConfig(rules)
const recommendedRules = allRules;
const plugin = {
meta: {
name: _package.name,
version: _package.version
},
all: {
plugins: ["jest-dom"],
rules: generateAllRulesConfig(rules)
}
};
configs: {
recommended: {
plugins: ["jest-dom"],
rules: recommendedRules
},
all: {
plugins: ["jest-dom"],
rules: allRules
}
},
rules
};
plugin.configs["flat/recommended"] = {
plugins: {
"jest-dom": plugin
},
rules: recommendedRules
};
plugin.configs["flat/all"] = {
plugins: {
"jest-dom": plugin
},
rules: allRules
};
var _default = exports.default = plugin; // explicitly export config to allow using this plugin in CJS-based
// eslint.config.js files without needing to deal with the .default
// and also retain backwards compatibility with `.eslintrc` configs
const configs = exports.configs = plugin.configs;
{
"name": "eslint-plugin-jest-dom",
"version": "5.1.1",
"version": "5.2.0",
"description": "ESLint plugin to follow best practices and anticipate common mistakes when writing tests with jest-dom",

@@ -34,3 +34,3 @@ "main": "dist/index.js",

"pregenerate-readme-table": "npm run build",
"generate-readme-table": "eslint-doc-generator --ignore-config all",
"generate-readme-table": "eslint-doc-generator",
"lint": "kcd-scripts lint",

@@ -37,0 +37,0 @@ "lint:generate-readme-table": "npm run generate-readme-table -- --check",

@@ -50,2 +50,13 @@ <div align="center">

> [!NOTE]
>
> `eslint.config.js` is supported, though most of the plugin documentation still
> currently uses `.eslintrc` syntax; compatible versions of configs are available
> prefixed with `flat/` and may be subject to small breaking changes while ESLint
> v9 is being finalized.
>
> Refer to the
> [ESLint documentation on the new configuration file format](https://eslint.org/docs/latest/use/configure/configuration-files-new)
> for more.
Add `jest-dom` to the plugins section of your `.eslintrc.js` configuration file.

@@ -82,4 +93,3 @@ You can omit the `eslint-plugin-` prefix:

To enable this configuration use the `extends` property in your `.eslintrc.js`
config file:
To enable this configuration with `.eslintrc`, use the `extends` property:

@@ -95,2 +105,16 @@ ```javascript

To enable this configuration with `eslint.config.js`, use
`jestDom.configs['flat/recommended']`:
```javascript
module.exports = [
{
files: [
/* glob matching your test files */
],
...require("eslint-plugin-jest-dom").configs["flat/recommended"],
},
];
```
## Supported Rules

@@ -97,0 +121,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc