eslint

sonarqube-jenkins-config

梦想的初衷 提交于 2021-01-19 06:36:49
Sonar Config .Jenkinsfile config stage('SonarQube analysis') { steps { script { scannerHome = tool 'SonarScanner4'; } withSonarQubeEnv('SonarQube') { sh "${scannerHome}/bin/sonar-scanner" } } } sonar-project.properties sonar.projectBaseDir=test-app // app dir sonar.projectName=test-app sonar.projectKey=test-app sonar.projectVersion=1.0 sonar.sourceEncoding=UTF-8 sonar.language=js sonar.sources=src sonar.tests=test sonar.exclusions=test/**,node_modules/**,build/**,**/less/**,**/config/**,**/config.js,**/imgs/** // files not to test sonar.test.inclusions=test/shared/*.js,test/components/**/*.js

Must use destructuring props assignment (react/destructuring-assignment)

别说谁变了你拦得住时间么 提交于 2021-01-13 08:31:53
问题 I've applied eslint airbnb standard to my code, so now this code: handleSubmit = (event) => { event.preventDefault(); this.props.onSearch(this.query.value); event.target.blur(); } causes this error: [eslint] Must use destructuring props assignment (react/destructuring-assignment) onSearch basically a trigger that passes up a value to parent component. How do I refactor this code to meet the eslint requirements? 回答1: handleSubmit = (event) => { event.preventDefault(); const {onSearch} = this

Vue混入的详解

好久不见. 提交于 2021-01-12 05:06:13
简介     混入 (mixins) 是一种分发 Vue 组件中可复用功能的非常灵活的方式。混入对象可以包含任意组件选项。当组件使用混入对象时,所有混入对象的选项将被混入该组件本身的选项。 钩子函数合并     同名钩子函数将混合为一个数组,因此都将被调用。另外,混入对象的钩子函数将在组件自身钩子函数之前调用 < body > < div id ="app" ></ div > </ body > </ html > < script src ="./vue.js" ></ script > < script > var Mixins = { created() { console.log( ' Mixins Created ' ) } } new Vue({ el: ' #app ' , mixins: [Mixins], created() { console.log( ' #app Created ' ) } }) // Mixins Created // #app Created </ script > 数据对象合并     数据对象在内部会进行浅合并 (一层属性深度),在和组件的数据发生冲突时以组件数据优先(组件的data中变量会覆盖混入对象的data中变量) < body > < div id ="app" ></ div > </ body > < script

HTML5 拖放API与Vue.js实战

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-08 18:27:32
// 每日前端夜话 第466篇 // 正文共:3800 字 // 预计阅读时间:12 分钟 拖放 API 将可拖动元素添加到 HTML,使我们可以构建包含可以拖动的具有丰富 UI 元素的 Web 应用。 在本文中我们将用 Vue.js 构建一个简单的看板应用。看板是一种项目管理工具,使用户可以从头到尾直观地管理项目。Trello、Pivotal Tracker 和 Jira 等工具都属于看板应用。 设置看板 运行以下命令创建我们的看板项目: vue create kanban-board 在创建项目时,该选择只包含 Babel 和 ESlint 的默认预设。 完成后,删除默认组件 HelloWorld ,将 App 组件修改为空,仅包含裸组件模板: < template > < div > </ div > </ template > < script > export default { name : 'App' , components : {}, }; </ script > < style > </ style > 接下来用 Bootstrap 进行样式设置,只需 Bootstrap CSS CDN 就够了。将其添加到 public/index.html 的 head 重。 < head > < meta charset = "utf-8" > < meta http

Disable VS Code javascript check

主宰稳场 提交于 2021-01-07 06:04:33
问题 I am passing a twig object to javascript via script tags in a .html.twig file, and VS Code complains that "Property assignment expected. js [17, 38]". Is it possible to turn this off completely for .html.twig-files or perhaps turn off checking altogether? I am using ESLint extension in any case. <script> ... window.PROPS = {{ props|json_encode|raw }}; ... </script> (edit) Just to clarify, ESLint is not responsible for these problem-messages. I can turn off the ESLint extension (and reload the

Disable VS Code javascript check

a 夏天 提交于 2021-01-07 06:02:30
问题 I am passing a twig object to javascript via script tags in a .html.twig file, and VS Code complains that "Property assignment expected. js [17, 38]". Is it possible to turn this off completely for .html.twig-files or perhaps turn off checking altogether? I am using ESLint extension in any case. <script> ... window.PROPS = {{ props|json_encode|raw }}; ... </script> (edit) Just to clarify, ESLint is not responsible for these problem-messages. I can turn off the ESLint extension (and reload the

Beginner question struggling with React Component implementation getting strange “this” error

╄→尐↘猪︶ㄣ 提交于 2021-01-05 07:26:06
问题 Beginner question struggling with React Component implementation. I have tried everything in the cookbook on this error but no luck. Expected 'this' to be used by class method 'aaaa' What is wrong with his code: import React from 'react'; class TestStuff extends React.Component { constructor(props) { super(props); this.aaaa = this.aaaa.bind(this); } aaaa() { console.log('dddddd'); } render() { return <div>test</div>; } } export default TestStuff; 回答1: The warning is just saying, I see that

ESLint error - ESLint couldn't find the config “react-app”

假装没事ソ 提交于 2021-01-03 06:43:13
问题 Me with my team, start a new React Project using the create-react-app bootstrap command. We add the eslint section on the project but we stuck with annoying error that we never found it before now. When we launch the command yarn run lint Here the error: Here the package.json: { "name": "name of the app", "version": "0.1.0", "private": true, "dependencies": { "jwt-decode": "^2.2.0", "react": "^16.12.0", "react-dom": "^16.12.0", "react-intl": "^3.12.0", "react-router": "^5.1.2", "react-router

ESlint: Turning off a specific rule across a project

为君一笑 提交于 2021-01-02 19:16:35
问题 I've read the docs on how to disable rules from within a file, however I'm wondering if there is a way to disable or overwrite rules from .eslintrc without overwriting other previous rules & presets I defined. I'm working in an AngularJS project so I used extends property inside my .eslintrc file. There are 3 specific rules from the angular ESlint plugin that I would like to disable, without disabling everything else I was using previously. Without the rules property all of my linting rules

ESLint extends vs plugins v2020

点点圈 提交于 2020-12-31 04:55:07
问题 There's answered question which in my opinion doesn't actually answers the question, on the difference between extends: [] vs plugins: [] in ESLint. In my case, i just used extends section: extends: [ 'plugin:@typescript-eslint/recommended', ], plugins: [], rules: { '@typescript-eslint/explicit-function-return-type': [ 'error', { allowExpressions: true, }, ], } As you can see, i just used predefined config from plugin:@typescript-eslint/recommended and also overwritten @typescript-eslint