Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const filterReports = require('../filterReports');
const isReactReduxConnect = require('../isReactReduxConnect');
const noUnusedPropTypesReact = require('eslint-plugin-react').rules['no-unused-prop-types'];
const belongsToReduxReact = (node, objectName, destrArg) => {
const checkProp = (secondArgument) => {
const secondArgumentName = secondArgument && secondArgument.type === 'Identifier' && secondArgument.name;
return (secondArgumentName === objectName // ownProps.myProp
|| destrArg === secondArgument // {myProp} in fn argument
|| (destrArg && destrArg.parent.type === 'VariableDeclarator' && destrArg.parent.init.name === secondArgumentName) // const {myProp} = ownProps;
);
};
let isReactRedux = false;
if (node.type === 'VariableDeclaration') {
node.declarations.forEach((decl) => {
const name = decl.id && decl.id.name;
if (name === 'mapStateToProps' || name === 'mapDispatchToProps') {
const secondArgument = decl.init.params && decl.init.params[1];
if (checkProp(secondArgument)) {
const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended').default.overrides[0];
const typescriptRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
const typescriptRecommendedTypeChecking = require('@typescript-eslint/eslint-plugin/dist/configs/recommended-requiring-type-checking.json');
const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');
const react = require('eslint-plugin-react').configs.recommended;
const jsxA11y = require('eslint-plugin-jsx-a11y').configs.recommended;
const reactPrettier = require('eslint-config-prettier/react');
const typescriptOverrides = {
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
plugins: [
"@typescript-eslint",
"@typescript-eslint/tslint",
"react",
"@swissquote/swissquote/react/no-redundant-should-component-update":
"error",
"@swissquote/swissquote/react/no-typos": "error",
"@swissquote/swissquote/react/no-unused-state": "error",
"@swissquote/swissquote/react/no-will-update-set-state": "error",
"@swissquote/swissquote/react/prefer-es6-class": ["error", "always"],
"@swissquote/swissquote/react/prefer-stateless-function": [
"error",
{ ignorePureComponents: true }
],
"@swissquote/swissquote/react/void-dom-elements-no-children": "error"
}
};
addMissingRules(
require("eslint-plugin-react").configs.recommended.rules,
module.exports.rules
);
var _ = require('lodash');
var eslint = require('eslint');
var glob = require('glob');
var path = require('path');
var SourceCodeFixer = require('eslint/lib/util/source-code-fixer');
var ruleUtils = require('./rule_utils');
var ESLINT_CONFIG = require('./config/eslint');
var customRules = {};
var reactRules = require('eslint-plugin-react').rules;
_.defaults(customRules, reactRules);
var loadPlugin = (pluginName, configPath) => {
var rules;
if (pluginName !== 'react') {
if (pluginName.indexOf('eslint-plugin-') === -1) {
pluginName = `eslint-plugin-${pluginName}`;
}
var baseName = pluginName.replace('eslint-plugin-', '');
if (pluginName.indexOf('/') !== -1) {
baseName = path.basename(baseName);