Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
43
Frontend-Learner/node_modules/eslint-plugin-unicorn/rules/no-unreadable-iife.js
generated
vendored
Normal file
43
Frontend-Learner/node_modules/eslint-plugin-unicorn/rules/no-unreadable-iife.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import {isParenthesized, getParenthesizedRange, toLocation} from './utils/index.js';
|
||||
|
||||
const MESSAGE_ID_ERROR = 'no-unreadable-iife';
|
||||
const messages = {
|
||||
[MESSAGE_ID_ERROR]: 'IIFE with parenthesized arrow function body is considered unreadable.',
|
||||
};
|
||||
|
||||
/** @param {import('eslint').Rule.RuleContext} context */
|
||||
const create = context => ({
|
||||
CallExpression(callExpression) {
|
||||
const {sourceCode} = context;
|
||||
|
||||
if (
|
||||
callExpression.callee.type !== 'ArrowFunctionExpression'
|
||||
|| callExpression.callee.body.type === 'BlockStatement'
|
||||
|| !isParenthesized(callExpression.callee.body, sourceCode)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
node: callExpression,
|
||||
loc: toLocation(getParenthesizedRange(callExpression.callee.body, context), context),
|
||||
messageId: MESSAGE_ID_ERROR,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
/** @type {import('eslint').Rule.RuleModule} */
|
||||
const config = {
|
||||
create,
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Disallow unreadable IIFEs.',
|
||||
recommended: 'unopinionated',
|
||||
},
|
||||
hasSuggestions: false,
|
||||
messages,
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Loading…
Add table
Add a link
Reference in a new issue