Socket
Socket
Sign inDemoInstall

eslint-plugin-unicorn

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-unicorn - npm Package Compare versions

Comparing version 38.0.1 to 39.0.0

rules/fix/remove-parentheses.js

14

configs/recommended.js

@@ -25,2 +25,3 @@ 'use strict';

'unicorn/no-array-reduce': 'error',
'unicorn/no-await-expression-member': 'error',
'unicorn/no-console-spaces': 'error',

@@ -62,2 +63,3 @@ 'unicorn/no-document-cookie': 'error',

'unicorn/prefer-at': 'off',
'unicorn/prefer-code-point': 'error',
'unicorn/prefer-date-now': 'error',

@@ -101,3 +103,5 @@ 'unicorn/prefer-default-parameters': 'error',

'unicorn/require-number-to-fixed-digits-argument': 'error',
'unicorn/require-post-message-target-origin': 'error',
// Turned off because we can't distinguish `widow.postMessage` and `{Worker,MessagePort,Client,BroadcastChannel}#postMessage()`
// See #1396
'unicorn/require-post-message-target-origin': 'off',
'unicorn/string-content': 'off',

@@ -108,10 +112,2 @@ 'unicorn/template-indent': 'warn',

},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'unicorn/require-post-message-target-origin': 'off',
},
},
],
};
{
"name": "eslint-plugin-unicorn",
"version": "38.0.1",
"version": "39.0.0",
"description": "Various awesome ESLint rules",

@@ -17,3 +17,10 @@ "license": "MIT",

"scripts": {
"test": "xo && nyc ava",
"fix": "run-p --continue-on-error fix:*",
"fix:js": "npm run lint:js -- --fix",
"fix:md": "npm run lint:md -- --fix",
"lint": "run-p --continue-on-error lint:*",
"lint:js": "xo",
"lint:md": "markdownlint \"**/*.md\"",
"test": "npm-run-all --continue-on-error lint test:*",
"test:js": "nyc ava",
"create-rule": "node ./scripts/create-rule.mjs && npm run generate-rules-table && npm run generate-usage-example",

@@ -75,3 +82,5 @@ "run-rules-on-codebase": "node ./test/run-rules-on-codebase/lint.mjs",

"lodash-es": "4.17.21",
"markdownlint-cli": "^0.29.0",
"mem": "^9.0.1",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",

@@ -78,0 +87,0 @@ "outdent": "^0.8.0",

# eslint-plugin-unicorn [![Coverage Status](https://codecov.io/gh/sindresorhus/eslint-plugin-unicorn/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/eslint-plugin-unicorn/branch/main) [![npm version](https://img.shields.io/npm/v/eslint-plugin-unicorn.svg?style=flat)](https://npmjs.com/package/eslint-plugin-unicorn)
<!-- markdownlint-disable-next-line no-inline-html -->
<img src="https://cloud.githubusercontent.com/assets/170270/18659176/1cc373d0-7f33-11e6-890f-0ba35362ee7e.jpg" width="180" align="right">

@@ -13,4 +14,4 @@

```console
$ npm install --save-dev eslint eslint-plugin-unicorn
```sh
npm install --save-dev eslint eslint-plugin-unicorn
```

@@ -59,2 +60,3 @@

"unicorn/no-array-reduce": "error",
"unicorn/no-await-expression-member": "error",
"unicorn/no-console-spaces": "error",

@@ -95,2 +97,3 @@ "unicorn/no-document-cookie": "error",

"unicorn/prefer-at": "off",
"unicorn/prefer-code-point": "error",
"unicorn/prefer-date-now": "error",

@@ -131,18 +134,7 @@ "unicorn/prefer-default-parameters": "error",

"unicorn/require-number-to-fixed-digits-argument": "error",
"unicorn/require-post-message-target-origin": "error",
"unicorn/require-post-message-target-origin": "off",
"unicorn/string-content": "off",
"unicorn/template-indent": "warn",
"unicorn/throw-new-error": "error"
},
"overrides": [
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {
"unicorn/require-post-message-target-origin": "off"
}
}
]
}
}

@@ -157,5 +149,5 @@ }

* ✅ if it belongs to the `recommended` configuration
* 🔧 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
* 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
- ✅ if it belongs to the `recommended` configuration
- 🔧 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
- 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)

@@ -187,2 +179,3 @@ <!-- Do not manually modify this table. Run: `npm run generate-rules-table` -->

| [no-array-reduce](docs/rules/no-array-reduce.md) | Disallow `Array#reduce()` and `Array#reduceRight()`. | ✅ | | |
| [no-await-expression-member](docs/rules/no-await-expression-member.md) | Forbid member access from await expression. | ✅ | 🔧 | |
| [no-console-spaces](docs/rules/no-console-spaces.md) | Do not use leading/trailing space between `console.log` parameters. | ✅ | 🔧 | |

@@ -222,2 +215,3 @@ | [no-document-cookie](docs/rules/no-document-cookie.md) | Do not use `document.cookie` directly. | ✅ | | |

| [prefer-at](docs/rules/prefer-at.md) | Prefer `.at()` method for index access and `String#charAt()`. | | 🔧 | 💡 |
| [prefer-code-point](docs/rules/prefer-code-point.md) | Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`. | ✅ | | 💡 |
| [prefer-date-now](docs/rules/prefer-date-now.md) | Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch. | ✅ | 🔧 | |

@@ -229,3 +223,3 @@ | [prefer-default-parameters](docs/rules/prefer-default-parameters.md) | Prefer default parameters over reassignment. | ✅ | 🔧 | 💡 |

| [prefer-dom-node-text-content](docs/rules/prefer-dom-node-text-content.md) | Prefer `.textContent` over `.innerText`. | ✅ | | 💡 |
| [prefer-export-from](docs/rules/prefer-export-from.md) | Prefer `export…from` when re-exporting. | ✅ | 🔧 | |
| [prefer-export-from](docs/rules/prefer-export-from.md) | Prefer `export…from` when re-exporting. | ✅ | 🔧 | 💡 |
| [prefer-includes](docs/rules/prefer-includes.md) | Prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence. | ✅ | 🔧 | 💡 |

@@ -259,3 +253,3 @@ | [prefer-keyboard-event-key](docs/rules/prefer-keyboard-event-key.md) | Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`. | ✅ | 🔧 | |

| [require-number-to-fixed-digits-argument](docs/rules/require-number-to-fixed-digits-argument.md) | Enforce using the digits argument with `Number#toFixed()`. | ✅ | 🔧 | |
| [require-post-message-target-origin](docs/rules/require-post-message-target-origin.md) | Enforce using the `targetOrigin` argument with `window.postMessage()`. | ✅ | | 💡 |
| [require-post-message-target-origin](docs/rules/require-post-message-target-origin.md) | Enforce using the `targetOrigin` argument with `window.postMessage()`. | | | 💡 |
| [string-content](docs/rules/string-content.md) | Enforce better string content. | | 🔧 | 💡 |

@@ -310,9 +304,10 @@ | [template-indent](docs/rules/template-indent.md) | Fix whitespace-insensitive template indentation. | | 🔧 | |

- [Sindre Sorhus](https://github.com/sindresorhus)
- [Adam Babcock](https://github.com/MrHen)
- [Fisker Cheung](https://github.com/fisker)
- [Bryan Mishkin](https://github.com/bmish)
- [futpib](https://github.com/futpib)
- [Fisker Cheung](https://github.com/fisker)
###### Former
### Former
- [Jeroen Engels](https://github.com/jfmengels)
- [Sam Verschueren](https://github.com/SamVerschueren)
- [Adam Babcock](https://github.com/MrHen)

@@ -17,2 +17,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -105,2 +106,3 @@ const {sortCharacterClasses} = context.options[0] || {};

type: 'object',
additionalProperties: false,
properties: {

@@ -115,2 +117,3 @@ sortCharacterClasses: {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -117,0 +120,0 @@ create,

@@ -35,2 +35,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -104,2 +105,3 @@ const options = {

type: 'object',
additionalProperties: false,
properties: {

@@ -117,2 +119,3 @@ name: {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -119,0 +122,0 @@ create,

@@ -54,2 +54,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -153,2 +154,3 @@ const source = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -155,0 +157,0 @@ create,

@@ -152,2 +152,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -200,2 +201,3 @@ const {checkArrowFunctions} = {checkArrowFunctions: true, ...context.options[0]};

type: 'object',
additionalProperties: false,
properties: {

@@ -210,2 +212,3 @@ checkArrowFunctions: {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -212,0 +215,0 @@ create,

@@ -185,2 +185,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -192,2 +193,3 @@ ClassDeclaration: node => customErrorDefinition(context, node),

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -194,0 +196,0 @@ create,

@@ -14,6 +14,5 @@ 'use strict';

'ObjectExpression[properties.length=0]',
'StaticBlock[body.length=0]',
// Experimental https://github.com/tc39/proposal-record-tuple
'RecordExpression[properties.length=0]',
// Experimental https://github.com/tc39/proposal-class-static-block
'StaticBlock[body.length=0]',
]);

@@ -49,2 +48,3 @@

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -51,0 +51,0 @@ create,

@@ -28,2 +28,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -86,2 +87,3 @@ [selector](expression) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -88,0 +90,0 @@ create,

@@ -23,2 +23,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -51,2 +52,3 @@ Literal(node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -53,0 +55,0 @@ create,

@@ -245,2 +245,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -514,2 +515,3 @@ const options = {

type: 'object',
additionalProperties: false,
properties: {

@@ -535,6 +537,6 @@ terms: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -541,0 +543,0 @@ create,

@@ -188,2 +188,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -198,2 +199,3 @@ 'non-zero': {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -200,0 +202,0 @@ create: checkVueTemplate(create),

@@ -145,2 +145,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -257,2 +258,3 @@ const options = context.options[0] || {};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -259,0 +261,0 @@ create,

@@ -6,2 +6,3 @@ 'use strict';

extendFixRange: require('./extend-fix-range.js'),
removeParentheses: require('./remove-parentheses.js'),

@@ -8,0 +9,0 @@ appendArgument: require('./append-argument.js'),

@@ -23,2 +23,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -41,2 +42,3 @@ const options = context.options[0] || {};

type: 'object',
additionalProperties: false,
properties: {

@@ -48,6 +50,6 @@ ignoreImports: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -54,0 +56,0 @@ create,

@@ -153,2 +153,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -311,55 +312,60 @@ let [

const schema = [
{
type: 'object',
properties: {
checkImport: {
type: 'boolean',
const schema = {
type: 'array',
additionalItems: false,
items: [
{
type: 'object',
additionalProperties: false,
properties: {
checkImport: {
type: 'boolean',
},
checkDynamicImport: {
type: 'boolean',
},
checkExportFrom: {
type: 'boolean',
},
checkRequire: {
type: 'boolean',
},
extendDefaultStyles: {
type: 'boolean',
},
styles: {
$ref: '#/definitions/moduleStyles',
},
},
checkDynamicImport: {
type: 'boolean',
},
],
definitions: {
moduleStyles: {
type: 'object',
additionalProperties: {
$ref: '#/definitions/styles',
},
checkExportFrom: {
type: 'boolean',
},
checkRequire: {
type: 'boolean',
},
extendDefaultStyles: {
type: 'boolean',
},
styles: {
$ref: '#/items/0/definitions/moduleStyles',
},
},
additionalProperties: false,
definitions: {
moduleStyles: {
type: 'object',
additionalProperties: {
$ref: '#/items/0/definitions/styles',
styles: {
anyOf: [
{
enum: [
false,
],
},
},
styles: {
anyOf: [
{
enum: [
false,
],
},
{
$ref: '#/items/0/definitions/booleanObject',
},
],
},
booleanObject: {
type: 'object',
additionalProperties: {
type: 'boolean',
{
$ref: '#/definitions/booleanObject',
},
],
},
booleanObject: {
type: 'object',
additionalProperties: {
type: 'boolean',
},
},
},
];
};
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -366,0 +372,0 @@ create,

@@ -15,2 +15,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -70,2 +71,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -72,0 +74,0 @@ create,

@@ -10,2 +10,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -38,2 +39,3 @@ * Program(node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -40,0 +42,0 @@ create,

@@ -190,2 +190,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -224,2 +225,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -226,0 +228,0 @@ create,

@@ -367,2 +367,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -420,2 +421,3 @@ const functionStack = [];

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -422,0 +424,0 @@ create,

@@ -162,2 +162,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -164,0 +165,0 @@ create,

@@ -113,2 +113,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -120,6 +121,6 @@ ignore: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -126,0 +127,0 @@ create,

@@ -41,2 +41,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -51,2 +52,3 @@ allowSimpleOperations: {

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -85,2 +87,3 @@ const {allowSimpleOperations} = {allowSimpleOperations: true, ...context.options[0]};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -87,0 +90,0 @@ create,

@@ -30,2 +30,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -75,2 +76,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -77,0 +79,0 @@ create,

@@ -31,2 +31,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -33,0 +34,0 @@ create,

@@ -16,2 +16,9 @@ 'use strict';

const isTripleSlashDirective = node =>
node.type === 'Line' && node.value.startsWith('/');
const hasTripeSlashDirectives = comments =>
comments.some(currentNode => isTripleSlashDirective(currentNode));
/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -30,2 +37,9 @@ const filename = context.getPhysicalFilename().toLowerCase();

const sourceCode = context.getSourceCode();
const comments = sourceCode.getAllComments();
if (hasTripeSlashDirectives(comments)) {
return;
}
return {

@@ -39,2 +53,3 @@ node,

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -41,0 +56,0 @@ create,

@@ -263,2 +263,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -415,2 +416,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -417,0 +419,0 @@ create,

@@ -24,2 +24,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -34,2 +35,3 @@ Literal: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -36,0 +38,0 @@ create,

@@ -19,2 +19,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -52,2 +53,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -54,0 +56,0 @@ create: checkVueTemplate(create),

@@ -43,2 +43,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -45,0 +46,0 @@ create,

@@ -170,2 +170,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -189,6 +190,6 @@ disallowedPrefixes: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -195,0 +196,0 @@ create,

@@ -123,2 +123,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -138,2 +139,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -140,0 +142,0 @@ create,

@@ -13,2 +13,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -36,2 +37,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -38,0 +40,0 @@ create,

@@ -78,2 +78,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -85,2 +86,3 @@ [newArraySelector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -87,0 +89,0 @@ create,

@@ -52,2 +52,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -81,2 +82,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -83,0 +85,0 @@ create,

@@ -35,2 +35,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -97,2 +98,3 @@ const {checkStrictEquality} = {

type: 'object',
additionalProperties: false,
properties: {

@@ -104,6 +106,6 @@ checkStrictEquality: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -110,0 +112,0 @@ create,

@@ -16,2 +16,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -36,2 +37,3 @@ [objectParameterSelector]: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -38,0 +40,0 @@ create,

@@ -32,2 +32,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -79,2 +80,3 @@ const startsWithHashBang = context.getSourceCode().lines[0].indexOf('#!') === 0;

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -81,0 +83,0 @@ create,

@@ -218,2 +218,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -220,0 +221,0 @@ create,

@@ -23,2 +23,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -35,2 +36,3 @@ [selector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -37,0 +39,0 @@ create,

@@ -14,2 +14,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -70,2 +71,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -72,0 +74,0 @@ create,

@@ -15,2 +15,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -60,2 +61,3 @@ 'Literal[regex]': node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -62,0 +64,0 @@ create,

@@ -83,2 +83,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -229,2 +230,3 @@ const getPropertyDisplayName = property => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -231,0 +233,0 @@ create,

@@ -6,4 +6,4 @@ 'use strict';

getParenthesizedRange,
getParentheses,
} = require('./utils/parentheses.js');
const {removeParentheses} = require('./fix/index.js');
const shouldAddParenthesesToSpreadElementArgument = require('./utils/should-add-parentheses-to-spread-element-argument.js');

@@ -53,7 +53,3 @@

) {
const parentheses = getParentheses(logicalExpression, sourceCode);
for (const token of parentheses) {
yield fixer.remove(token);
}
yield * removeParentheses(logicalExpression, fixer, sourceCode);
}

@@ -67,2 +63,3 @@ },

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -69,0 +66,0 @@ create,

@@ -138,2 +138,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -140,0 +141,0 @@ create,

@@ -8,5 +8,4 @@ 'use strict';

} = require('./selectors/index.js');
const {getParentheses} = require('./utils/parentheses.js');
const typedArray = require('./shared/typed-array.js');
const {fixSpaceAroundKeyword} = require('./fix/index.js');
const {removeParentheses, fixSpaceAroundKeyword} = require('./fix/index.js');

@@ -111,6 +110,3 @@ const SPREAD_IN_LIST = 'spread-in-list';

// ^^ ^^
const parentheses = getParentheses(spreadObject, sourceCode);
for (const parenthesis of parentheses) {
yield fixer.remove(parenthesis);
}
yield * removeParentheses(spreadObject, fixer, sourceCode);

@@ -216,2 +212,3 @@ // `[...[foo]]`

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -218,0 +215,0 @@ create,

@@ -92,2 +92,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -194,2 +195,3 @@ const listener = (fix, checkFunctionReturnType) => node => {

type: 'object',
additionalProperties: false,
properties: {

@@ -200,6 +202,6 @@ checkArguments: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -206,0 +208,0 @@ create,

@@ -15,2 +15,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -67,2 +68,3 @@ Literal: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -69,0 +71,0 @@ create,

@@ -19,2 +19,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -41,2 +42,3 @@ Literal: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -43,0 +45,0 @@ create: checkVueTemplate(create),

@@ -136,2 +136,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -152,3 +153,2 @@ onlyIfContainsSeparator: {

},
additionalProperties: false,
});

@@ -158,2 +158,3 @@

type: 'object',
additionalProperties: false,
properties: {

@@ -168,5 +169,5 @@ ...Object.fromEntries(

},
additionalProperties: false,
}];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -173,0 +174,0 @@ create,

@@ -61,2 +61,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -161,2 +162,3 @@ const options = context.options[0] || {};

type: 'object',
additionalProperties: false,
properties: {

@@ -171,6 +173,6 @@ excludedPackages: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -177,0 +179,0 @@ create,

@@ -230,2 +230,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -325,2 +326,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -327,0 +329,0 @@ create,

@@ -22,2 +22,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -56,2 +57,3 @@ [selector](flatCallExpression) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -58,0 +60,0 @@ create,

@@ -237,2 +237,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -244,6 +245,6 @@ functions: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -250,0 +251,0 @@ create,

@@ -9,2 +9,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -11,0 +12,0 @@ create: context => createListeners(context),

@@ -61,2 +61,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -131,2 +132,3 @@ [arrayFindCallSelector](findCall) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -133,0 +135,0 @@ create: checkVueTemplate(create),

@@ -287,2 +287,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -298,6 +299,6 @@ getLastElementFunctions: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -304,0 +305,0 @@ create,

@@ -69,2 +69,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -104,2 +105,3 @@ [methodsSelector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -106,0 +108,0 @@ create,

@@ -128,2 +128,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -212,2 +213,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -214,0 +216,0 @@ create,

@@ -18,2 +18,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -33,2 +34,3 @@ [selector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -35,0 +37,0 @@ create,

@@ -39,2 +39,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -56,2 +57,3 @@ [selector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -58,0 +60,0 @@ create,

@@ -25,2 +25,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -71,2 +72,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -73,0 +75,0 @@ create,

@@ -23,2 +23,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -54,2 +55,3 @@ [memberExpressionPropertySelector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -56,0 +58,0 @@ create,

@@ -8,5 +8,7 @@ 'use strict';

const MESSAGE_ID = 'prefer-export-from';
const MESSAGE_ID_ERROR = 'error';
const MESSAGE_ID_SUGGESTION = 'suggestion';
const messages = {
[MESSAGE_ID]: 'Use `export…from` to re-export `{{exported}}`.',
[MESSAGE_ID_ERROR]: 'Use `export…from` to re-export `{{exported}}`.',
[MESSAGE_ID_SUGGESTION]: 'Switch to `export…from`.',
};

@@ -76,3 +78,3 @@

function fix({
function getFixFunction({
context,

@@ -198,17 +200,5 @@ imported,

function * getProblems({
context,
variable,
program,
exportDeclarations,
}) {
const {identifiers, references} = variable;
if (identifiers.length !== 1 || references.length === 0) {
return;
}
const specifier = identifiers[0].parent;
const imported = {
function getImported(variable) {
const specifier = variable.identifiers[0].parent;
return {
name: getImportedName(specifier),

@@ -219,4 +209,7 @@ node: specifier,

};
}
for (const {identifier} of references) {
function getExports(imported, context) {
const exports = [];
for (const {identifier} of imported.variable.references) {
const exported = getExported(identifier, context);

@@ -237,25 +230,28 @@

if (imported.name === '*' && exported.name === 'default') {
return;
continue;
}
yield {
node: exported.node,
messageId: MESSAGE_ID,
data: {
exported: exported.name,
},
fix: fix({
context,
imported,
exported,
exportDeclarations,
program,
}),
};
exports.push(exported);
}
return exports;
}
const schema = [
{
type: 'object',
additionalProperties: false,
properties: {
ignoreUsedVariables: {
type: 'boolean',
default: false,
},
},
},
];
/** @param {import('eslint').Rule.RuleContext} context */
function create(context) {
const variables = [];
const {ignoreUsedVariables} = {ignoreUsedVariables: false, ...context.options[0]};
const importDeclarations = new Set();
const exportDeclarations = [];

@@ -265,3 +261,3 @@

'ImportDeclaration[specifiers.length>0]'(node) {
variables.push(...context.getDeclaredVariables(node));
importDeclarations.add(node);
},

@@ -273,9 +269,56 @@ // `ExportAllDeclaration` and `ExportDefaultDeclaration` can't be reused

* 'Program:exit'(program) {
for (const variable of variables) {
yield * getProblems({
context,
variable,
exportDeclarations,
program,
});
for (const importDeclaration of importDeclarations) {
const variables = context.getDeclaredVariables(importDeclaration)
.map(variable => {
const imported = getImported(variable);
const exports = getExports(imported, context);
return {
variable,
imported,
exports,
};
});
if (
ignoreUsedVariables
&& variables.some(({variable, exports}) => variable.references.length !== exports.length)
) {
continue;
}
const shouldUseSuggestion = ignoreUsedVariables
&& variables.some(({variable}) => variable.references.length === 0);
for (const {imported, exports} of variables) {
for (const exported of exports) {
const problem = {
node: exported.node,
messageId: MESSAGE_ID_ERROR,
data: {
exported: exported.name,
},
};
const fix = getFixFunction({
context,
imported,
exported,
exportDeclarations,
program,
});
if (shouldUseSuggestion) {
problem.suggest = [
{
messageId: MESSAGE_ID_SUGGESTION,
fix,
},
];
} else {
problem.fix = fix;
}
yield problem;
}
}
}

@@ -286,2 +329,3 @@ },

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -295,4 +339,6 @@ create,

fixable: 'code',
hasSuggestions: true,
schema,
messages,
},
};

@@ -45,2 +45,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -82,2 +83,3 @@ BinaryExpression: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -84,0 +86,0 @@ create,

@@ -83,9 +83,18 @@ 'use strict';

const {right = {}, operator} = nearestIf.test;
const isTestingEquality = operator === '==' || operator === '===';
const isRightValid = isTestingEquality && right.type === 'Literal' && typeof right.value === 'number';
const {type, operator, right} = nearestIf.test;
if (
!(
type === 'BinaryExpression'
&& (operator === '==' || operator === '===')
&& right.type === 'Literal'
&& typeof right.value === 'number'
)
) {
return;
}
// Either a meta key or a printable character
const keyCode = translateToKey[right.value] || String.fromCharCode(right.value);
const key = translateToKey[right.value] || String.fromCodePoint(right.value);
// And if we recognize the `.keyCode`
if (!isRightValid || !keyCode) {
if (!key) {
return;

@@ -97,3 +106,3 @@ }

fixer.replaceText(node, 'key'),
fixer.replaceText(right, quoteString(keyCode)),
fixer.replaceText(right, quoteString(key)),
];

@@ -109,2 +118,3 @@ };

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -168,2 +178,3 @@ 'Identifier:matches([name="keyCode"], [name="charCode"], [name="which"])'(node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -170,0 +181,0 @@ create,

@@ -32,2 +32,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -104,2 +105,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -106,0 +108,0 @@ create,

@@ -114,2 +114,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -124,2 +125,3 @@ [replaceChildOrInsertBeforeSelector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -126,0 +128,0 @@ create,

@@ -5,6 +5,9 @@ 'use strict';

const isStaticRequire = require('./utils/is-static-require.js');
const {getParentheses} = require('./utils/parentheses.js');
const assertToken = require('./utils/assert-token.js');
const {referenceIdentifierSelector} = require('./selectors/index.js');
const {replaceReferenceIdentifier, removeSpacesAfter} = require('./fix/index.js');
const {
removeParentheses,
replaceReferenceIdentifier,
removeSpacesAfter,
} = require('./fix/index.js');

@@ -38,11 +41,2 @@ const ERROR_USE_STRICT_DIRECTIVE = 'error/use-strict-directive';

function * removeParentheses(nodeOrNodes, fixer, sourceCode) {
for (const node of Array.isArray(nodeOrNodes) ? nodeOrNodes : [nodeOrNodes]) {
const parentheses = getParentheses(node, sourceCode);
for (const token of parentheses) {
yield fixer.remove(token);
}
}
}
function fixRequireCall(node, sourceCode) {

@@ -71,3 +65,6 @@ if (!isStaticRequire(node.parent) || node.parent.callee !== node) {

yield fixer.remove(closingParenthesisToken);
yield * removeParentheses([callee, requireCall, source], fixer, sourceCode);
for (const node of [callee, requireCall, source]) {
yield * removeParentheses(node, fixer, sourceCode);
}
};

@@ -130,3 +127,5 @@ }

yield * removeParentheses([callee, requireCall, source], fixer, sourceCode);
for (const node of [callee, requireCall, source]) {
yield * removeParentheses(node, fixer, sourceCode);
}

@@ -187,3 +186,5 @@ if (id.type === 'Identifier') {

yield * removeParentheses([node.parent, node], fixer, sourceCode);
for (const currentNode of [node.parent, node]) {
yield * removeParentheses(currentNode, fixer, sourceCode);
}
};

@@ -326,2 +327,3 @@ }

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -328,0 +330,0 @@ create,

@@ -133,2 +133,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -171,2 +172,3 @@ 'CallExpression[callee.type="MemberExpression"]': node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -173,0 +175,0 @@ create,

@@ -53,2 +53,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -60,6 +61,6 @@ checkRequire: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -66,0 +67,0 @@ create,

@@ -41,2 +41,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -131,2 +132,3 @@ const sourceCode = context.getSourceCode();

type: 'object',
additionalProperties: false,
properties: {

@@ -138,6 +140,6 @@ checkInfinity: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -144,0 +146,0 @@ create,

@@ -5,2 +5,3 @@ 'use strict';

const {matches, methodCallSelector} = require('./selectors/index.js');
const {removeParentheses} = require('./fix/index.js');
const {getParentheses, getParenthesizedText} = require('./utils/parentheses.js');

@@ -151,6 +152,3 @@ const {isNodeMatches, isNodeMatchesNameOrPath} = require('./utils/is-node-matches.js');

yield fixer.replaceText(functionBody, `[${keyText}, ${valueText}]`);
for (const parentheses of getParentheses(functionBody, sourceCode)) {
yield fixer.remove(parentheses);
}
yield * removeParentheses(functionBody, fixer, sourceCode);
}

@@ -254,2 +252,3 @@

type: 'object',
additionalProperties: false,
properties: {

@@ -261,6 +260,6 @@ functions: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -267,0 +266,0 @@ create,

@@ -84,2 +84,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -91,6 +92,6 @@ functions: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -97,0 +98,0 @@ create,

@@ -18,2 +18,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -65,2 +66,3 @@ [selector]: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -67,0 +69,0 @@ create,

@@ -68,2 +68,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -70,0 +71,0 @@ create,

@@ -102,2 +102,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -125,2 +126,3 @@ [selector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -127,0 +129,0 @@ create,

@@ -67,2 +67,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -82,2 +83,3 @@ [selector]: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -84,0 +86,0 @@ create,

@@ -85,2 +85,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => Object.fromEntries(

@@ -126,2 +127,3 @@ cases.map(checkCase => [

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -128,0 +130,0 @@ create: checkVueTemplate(create),

@@ -127,2 +127,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -190,2 +191,3 @@ [selector]: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -192,0 +194,0 @@ create,

@@ -323,2 +323,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -479,2 +480,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -481,0 +483,0 @@ create,

@@ -45,2 +45,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -66,2 +67,3 @@ [selector]: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -68,0 +70,0 @@ create,

@@ -43,2 +43,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -184,2 +185,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -186,0 +188,0 @@ create,

@@ -62,2 +62,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -175,2 +176,3 @@ const sourceCode = context.getSourceCode();

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -177,0 +179,0 @@ create,

@@ -18,2 +18,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -33,2 +34,3 @@ [selector](node) {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -35,0 +37,0 @@ create,

@@ -246,2 +246,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -306,2 +307,3 @@ const options = {

type: 'object',
additionalProperties: false,
properties: {

@@ -322,6 +324,6 @@ minimumCases: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -328,0 +330,0 @@ create,

@@ -46,2 +46,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -263,2 +264,3 @@ const onlySingleLine = context.options[0] === 'only-single-line';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -265,0 +267,0 @@ create,

@@ -91,2 +91,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -93,0 +94,0 @@ create,

@@ -113,2 +113,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = () => ({

@@ -131,2 +132,3 @@ [selector]: node => {

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -133,0 +135,0 @@ create,

@@ -323,2 +323,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -506,5 +507,5 @@ const options = prepareOptions(context.options[0]);

const extension = path.extname(filenameWithExtension);
const filename = path.basename(filenameWithExtension, extension);
const filenameReplacements = getNameReplacements(filename, options);
const filename = path.basename(filenameWithExtension);
const extension = path.extname(filename);
const filenameReplacements = getNameReplacements(path.basename(filename, extension), options);

@@ -518,3 +519,3 @@ if (filenameReplacements.total === 0) {

context.report({
...getMessage(filenameWithExtension, filenameReplacements, 'filename'),
...getMessage(filename, filenameReplacements, 'filename'),
node,

@@ -534,79 +535,84 @@ });

const schema = [
{
type: 'object',
properties: {
checkProperties: {
type: 'boolean',
const schema = {
type: 'array',
additionalItems: false,
items: [
{
type: 'object',
additionalProperties: false,
properties: {
checkProperties: {
type: 'boolean',
},
checkVariables: {
type: 'boolean',
},
checkDefaultAndNamespaceImports: {
type: [
'boolean',
'string',
],
pattern: 'internal',
},
checkShorthandImports: {
type: [
'boolean',
'string',
],
pattern: 'internal',
},
checkShorthandProperties: {
type: 'boolean',
},
checkFilenames: {
type: 'boolean',
},
extendDefaultReplacements: {
type: 'boolean',
},
replacements: {
$ref: '#/definitions/abbreviations',
},
extendDefaultAllowList: {
type: 'boolean',
},
allowList: {
$ref: '#/definitions/booleanObject',
},
ignore: {
type: 'array',
uniqueItems: true,
},
},
checkVariables: {
type: 'boolean',
},
],
definitions: {
abbreviations: {
type: 'object',
additionalProperties: {
$ref: '#/definitions/replacements',
},
checkDefaultAndNamespaceImports: {
type: [
'boolean',
'string',
],
pattern: 'internal',
},
checkShorthandImports: {
type: [
'boolean',
'string',
],
pattern: 'internal',
},
checkShorthandProperties: {
type: 'boolean',
},
checkFilenames: {
type: 'boolean',
},
extendDefaultReplacements: {
type: 'boolean',
},
replacements: {
$ref: '#/items/0/definitions/abbreviations',
},
extendDefaultAllowList: {
type: 'boolean',
},
allowList: {
$ref: '#/items/0/definitions/booleanObject',
},
ignore: {
type: 'array',
uniqueItems: true,
},
},
additionalProperties: false,
definitions: {
abbreviations: {
type: 'object',
additionalProperties: {
$ref: '#/items/0/definitions/replacements',
replacements: {
anyOf: [
{
enum: [
false,
],
},
},
replacements: {
anyOf: [
{
enum: [
false,
],
},
{
$ref: '#/items/0/definitions/booleanObject',
},
],
},
booleanObject: {
type: 'object',
additionalProperties: {
type: 'boolean',
{
$ref: '#/definitions/booleanObject',
},
],
},
booleanObject: {
type: 'object',
additionalProperties: {
type: 'boolean',
},
},
},
];
};
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -613,0 +619,0 @@ create,

@@ -44,2 +44,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -46,0 +47,0 @@ create,

'use strict';
const {methodCallSelector} = require('./selectors/index.js');
const {methodCallSelector, not} = require('./selectors/index.js');
const {appendArgument} = require('./fix/index.js');

@@ -10,6 +10,9 @@

const mathToFixed = methodCallSelector({
method: 'toFixed',
argumentsLength: 0,
});
const mathToFixed = [
methodCallSelector({
method: 'toFixed',
argumentsLength: 0,
}),
not('[callee.object.type="NewExpression"]'),
].join('');

@@ -39,2 +42,3 @@ /** @param {import('eslint').Rule.RuleContext} context */

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -41,0 +45,0 @@ create,

@@ -59,2 +59,3 @@ 'use strict';

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -61,0 +62,0 @@ create,

@@ -64,2 +64,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => {

@@ -140,2 +141,3 @@ const {patterns} = {

type: 'object',
additionalProperties: false,
properties: {

@@ -172,6 +174,6 @@ patterns: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -178,0 +180,0 @@ create,

@@ -107,2 +107,3 @@ 'use strict';

type: 'object',
additionalProperties: false,
properties: {

@@ -150,6 +151,6 @@ indent: {

},
additionalProperties: false,
},
];
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -156,0 +157,0 @@ create,

@@ -32,2 +32,3 @@ 'use strict';

/** @param {import('eslint').Rule.RuleContext} context */
const create = context => ({

@@ -41,2 +42,3 @@ [selector]: node => ({

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {

@@ -43,0 +45,0 @@ create,

@@ -6,2 +6,3 @@ 'use strict';

/** @returns {{ [ruleName: string]: import('eslint').Rule.RuleModule }} */
function createDeprecatedRules(data) {

@@ -8,0 +9,0 @@ return Object.fromEntries(

@@ -77,2 +77,3 @@ 'use strict';

/** @returns {import('eslint').Rule.RuleModule} */
function loadRule(ruleId) {

@@ -79,0 +80,0 @@ const rule = require(`../${ruleId}`);

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