Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何修复自定义脚本标记的eslint错误_Reactjs_Eslint - Fatal编程技术网

Reactjs 如何修复自定义脚本标记的eslint错误

Reactjs 如何修复自定义脚本标记的eslint错误,reactjs,eslint,Reactjs,Eslint,我正在使用nucleoapp.com上的自定义动画图标。然而,当我尝试复制和粘贴代码时,我得到了一个关于脚本标记中括号的eslint错误,并且我很难调试/修复这个linting错误。请参阅下面的屏幕截图和下面的代码。谢谢] .eslintrc: 组成部分: 标记中的内容不在{}中。在React中,语句应加括号 从“React”导入React; const SampleIcon={height=14,width=14,}=> 菜单向右箭头2 { !function{function te{var

我正在使用nucleoapp.com上的自定义动画图标。然而,当我尝试复制和粘贴代码时,我得到了一个关于脚本标记中括号的eslint错误,并且我很难调试/修复这个linting错误。请参阅下面的屏幕截图和下面的代码。谢谢]

.eslintrc:

组成部分:

标记中的内容不在{}中。在React中,语句应加括号

从“React”导入React; const SampleIcon={height=14,width=14,}=> 菜单向右箭头2 { !function{function te{var i=e.parentNode;ifsvg!==i.tagNamei=ti;return i;}function et,e,i,n{return 1t/=n/2?i/2*t*t*t+e:-i/2*t-=2*t*t*t-2+e}function it{this.element=t.topLine=this.element.getElementsByTagNamepath[0],this.bottomLine=this.element.getElementsByTagNamepath[1],this.lineLength=this.bottomelength.time={start:null,total:150},this.status={交互:!1,动画:!1},this.init}if!window.requestAnimationFrame{var n=null;window.requestAnimationFrame=functiont,e{var i=new Date.getTime;n | n=i;var s=Math.max0,16-i-n,a=window.setTimeoutfunction{ti+s},s;return n=i+s,a}i+s,a}i.init i.prototype=function=new Date.getTime;这个元素,点击{t.status.animating{t.status.animating=!0,window.requestanimationframe.triggerAnimation.bindt},i.prototype.triggerAnimation=functiont{var e=this.getProgresst,i=this.status.interactived?this.time.total-e:e;this.animateIconi.checkProgresse},i.prototype.getProgress=functiont{返回this.time.start}this.time.time.start=t,t-this.time.start},i.prototype.checkProgress=functiont{var e=this;this.time.totalt?window.requestAnimationFrame.triggerAnimation.binde:this.status={交互:!this.status.interactivated,animating:!1},this.time.start=null},i.prototype.animateCON=functiont{ifthis.time.totalt=this.time.total;if0tt=0;var i=et,0,1,this.time.toFixed2;this.topLine.setAttributetransform,translate+7*i++7*i+rotate+45*-i+29,this.bottomLine.setAttributetransform,translate+7*i++7*-i+rotate+45*i+223,this.topLine.setAttributestroke-dashoffset,i*this.bottomLength*.5,this.line.setAttributestroke-dashoffset,iis.lineLength*.5};var s=document.getelementsbyclassname nc-interact_menu-arrow-2-o-32;ifsforva=0;s.lengtha;a++新的its[a]}; } ; 导出默认采样图标;
module.exports = {
  env: {
    'jest/globals': true
  },
  extends: [
    'airbnb',
    'plugin:@typescript-eslint/recommended',
  ],
  globals: {
    'document': true,
    'window': true,
  },
  overrides: [
    {
      'files': ['**/*.tsx', '**/*.ts'],
      'rules': {
        'react/prop-types': 'off',
        'import/prefer-default-export': 'off',
      }
    }
  ],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    project: './tsconfig.json',
  },
  plugins: ['@typescript-eslint', 'jest'],
  rules: {
    'import/no-extraneous-dependencies': [
      'error',
      {
        'devDependencies': [
          '**/*.stories.jsx',
          '**/*.stories.tsx',
          '**/*.test.jsx',
          '**/*.test.js',
          '**/*.test.tsx',
          '**/*.test.ts',
          'setupTests.js',
          '**/storybook/*',
          '**/*.demo.tsx',
        ],
      },
    ],
    '@typescript-eslint/camelcase': ['error', { 'properties': 'never' }],
    'indent': 'off',
    '@typescript-eslint/indent': [
      'error',
      2,
      {
        'ignoredNodes': ['JSXElement'],
        'SwitchCase': 1,
      },
    ],
    '@typescript-eslint/explicit-function-return-type': ['error', {
      'allowExpressions': true,
      'allowTypedFunctionExpressions': true
    }],
    'semi': 'off',
    '@typescript-eslint/semi': ['error'],
    'react/destructuring-assignment': [false, 'always', { 'ignoreClassFields': true }],
    'react/jsx-filename-extension': [1, { 'extensions': ['.jsx', '.tsx'] }],
  },
  settings: {
    'import/extensions': [
      '.js',
      '.jsx',
      '.ts',
      '.tsx',
    ],
    'import/resolver': {
      webpack: {
        config: 'webpack.common.js',
      }
    }
  },
};
import React from 'react';

const SampleIcon = ({ height = 14, width = 14, }) => (
  <svg height={height} width={width} viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
    <title>menu to arrow right 2</title>
    <g fill="#111111" stroke="#111111" strokeLinecap="round" strokeWidth="2">
      <g className="nc-interact_menu-arrow-2-o-32" transform="rotate(180 16 16)">
        <path d="M2 9h28" fill="none" stroke="#111111" strokeDasharray="28 28" strokeLinecap="round" transform="translate(0 0) rotate(0 2 9)"/>
        <path d="M2 23h28" fill="none" stroke="#111111" strokeDasharray="28 28" strokeLinecap="round" transform="translate(0 0) rotate(0 2 23)"/>
      </g>
      <script>!function(){function t(e){var i=e.parentNode;if("svg"!==i.tagName)i=t(i);return i;}function e(t,e,i,n){return 1&gt;(t/=n/2)?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e}function i(t){this.element=t,this.topLine=this.element.getElementsByTagName("path")[0],this.bottomLine=this.element.getElementsByTagName("path")[1],this.lineLength=this.bottomLine.getTotalLength(),this.time={start:null,total:150},this.status={interacted:!1,animating:!1},this.init()}if(!window.requestAnimationFrame){var n=null;window.requestAnimationFrame=function(t,e){var i=(new Date).getTime();n||(n=i);var s=Math.max(0,16-(i-n)),a=window.setTimeout(function(){t(i+s)},s);return n=i+s,a}}i.prototype.init=function(){var t=this;this.element.addEventListener("click",function(){t.status.animating||(t.status.animating=!0,window.requestAnimationFrame(t.triggerAnimation.bind(t)))})},i.prototype.triggerAnimation=function(t){var e=this.getProgress(t),i=this.status.interacted?this.time.total-e:e;this.animateIcon(i),this.checkProgress(e)},i.prototype.getProgress=function(t){return this.time.start||(this.time.start=t),t-this.time.start},i.prototype.checkProgress=function(t){var e=this;this.time.total&gt;t?window.requestAnimationFrame(e.triggerAnimation.bind(e)):(this.status={interacted:!this.status.interacted,animating:!1},this.time.start=null)},i.prototype.animateIcon=function(t){if(t&gt;this.time.total)(t=this.time.total);if(0&gt;t)(t=0);var i=e(t,0,1,this.time.total).toFixed(2);this.topLine.setAttribute("transform","translate("+7*i+" "+7*i+") rotate("+45*-i+" 2 9)"),this.bottomLine.setAttribute("transform","translate("+7*i+" "+7*-i+") rotate("+45*i+" 2 23)"),this.topLine.setAttribute("stroke-dashoffset",i*this.lineLength*.5),this.bottomLine.setAttribute("stroke-dashoffset",i*this.lineLength*.5)};var s=document.getElementsByClassName("nc-interact_menu-arrow-2-o-32");if(s)for(var a=0;s.length&gt;a;a++)new i(t(s[a]))}();</script>
    </g>
  </svg>
);

export default SampleIcon;