eslint: disallow importing react-inlinesvg directly

This commit is contained in:
Alex Gleason 2022-04-10 13:18:10 -05:00
parent b391f65e3c
commit 734750a46a
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 8 additions and 2 deletions

View File

@ -94,6 +94,12 @@ module.exports = {
'no-loop-func': 'error', 'no-loop-func': 'error',
'no-mixed-spaces-and-tabs': 'error', 'no-mixed-spaces-and-tabs': 'error',
'no-nested-ternary': 'warn', 'no-nested-ternary': 'warn',
'no-restricted-imports': ['error', {
patterns: [{
group: ['react-inlinesvg'],
message: 'Use the SvgIcon component instead.',
}],
}],
'no-trailing-spaces': 'warn', 'no-trailing-spaces': 'warn',
'no-undef': 'error', 'no-undef': 'error',
'no-unreachable': 'error', 'no-unreachable': 'error',

View File

@ -7,7 +7,7 @@
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import InlineSVG from 'react-inlinesvg'; import InlineSVG from 'react-inlinesvg'; // eslint-disable-line no-restricted-imports
export default class SvgIcon extends React.PureComponent { export default class SvgIcon extends React.PureComponent {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import InlineSVG from 'react-inlinesvg'; import InlineSVG from 'react-inlinesvg'; // eslint-disable-line no-restricted-imports
interface ISvgIcon { interface ISvgIcon {
className?: string, className?: string,