eslint

Is there an elegant way to tell eslint to ensure that we're not using any ES6 syntax / functions?

邮差的信 提交于 2021-02-08 15:09:55
问题 Is there an elegant way to tell ESLint to ensure that we're not using any ES6 / EMCAScript 2015 syntax / functions? I've found the following answer somewhat helpful but it seems that it doesn't take care of everything (e.g. I don't see how to catch the usage of Object.assign()): How to disable usage of certain ES2015 features with ESLint 2? 回答1: eslint-plugin-es5 is the package dedicated to your use case. For example the rule es5/no-es6-static-methods forbids the usage of Object.assign . 来源:

Is there an elegant way to tell eslint to ensure that we're not using any ES6 syntax / functions?

主宰稳场 提交于 2021-02-08 15:01:27
问题 Is there an elegant way to tell ESLint to ensure that we're not using any ES6 / EMCAScript 2015 syntax / functions? I've found the following answer somewhat helpful but it seems that it doesn't take care of everything (e.g. I don't see how to catch the usage of Object.assign()): How to disable usage of certain ES2015 features with ESLint 2? 回答1: eslint-plugin-es5 is the package dedicated to your use case. For example the rule es5/no-es6-static-methods forbids the usage of Object.assign . 来源:

Is there an elegant way to tell eslint to ensure that we're not using any ES6 syntax / functions?

这一生的挚爱 提交于 2021-02-08 15:01:06
问题 Is there an elegant way to tell ESLint to ensure that we're not using any ES6 / EMCAScript 2015 syntax / functions? I've found the following answer somewhat helpful but it seems that it doesn't take care of everything (e.g. I don't see how to catch the usage of Object.assign()): How to disable usage of certain ES2015 features with ESLint 2? 回答1: eslint-plugin-es5 is the package dedicated to your use case. For example the rule es5/no-es6-static-methods forbids the usage of Object.assign . 来源:

ESlint in Eclipse

匆匆过客 提交于 2021-02-08 13:45:49
问题 I have been given a web project at work that has a .eslintrc file in it and was told to use it. I gather that this enforces code styles and sounds like a good idea, but I have never done this before. I just switched to Eclipse Neon. But I can find no tutorials on how to use it. I did find something that says eslint is now the default linter for Eclipse but that was for Orion. Can someone tell me how to use my .eslintrc file for all my .js files in Eclipse? 回答1: According to this, you have to

ESLint - How to restrict property of `this`

烂漫一生 提交于 2021-02-08 09:16:00
问题 To prohibit code like this.$log . The following config doesn't work: { 'no-restricted-properties': [ 2, { object: 'this', property: '$log', }, ], } 回答1: You can achieve this by using no-restricted-syntax rule. So in your .eslintrc file add this rule. "no-restricted-syntax": [ "error", { "selector": "MemberExpression[object.type='ThisExpression'][property.name='$log']", "message": "this.$log is prohibited" } ] 来源: https://stackoverflow.com/questions/65432897/eslint-how-to-restrict-property-of

ESLint - How to restrict property of `this`

泄露秘密 提交于 2021-02-08 09:15:51
问题 To prohibit code like this.$log . The following config doesn't work: { 'no-restricted-properties': [ 2, { object: 'this', property: '$log', }, ], } 回答1: You can achieve this by using no-restricted-syntax rule. So in your .eslintrc file add this rule. "no-restricted-syntax": [ "error", { "selector": "MemberExpression[object.type='ThisExpression'][property.name='$log']", "message": "this.$log is prohibited" } ] 来源: https://stackoverflow.com/questions/65432897/eslint-how-to-restrict-property-of

ESLint & Vue - How to ban the use of `$log`?

依然范特西╮ 提交于 2021-02-07 20:43:30
问题 Origin of $log : Vue.prototype.$log = console.log Places to be banned: <template> <!-- Place 1 --> <div @click="$log"> <!-- Place 2 --> {{ $log }} <!-- Place 3 --> {{ $log('foo') }} </div> </template> <script> import Vue from 'vue' // Place 4 Vue.prototype.$log('foo') export default { created() { // Place 5 this.$log('foo') }, } </script> Some additional information that might help: ESLint - How to restrict property of this no-restricted-syntax vue/no-restricted-syntax 回答1: After digging into

ESLint & Vue - How to ban the use of `$log`?

微笑、不失礼 提交于 2021-02-07 20:41:01
问题 Origin of $log : Vue.prototype.$log = console.log Places to be banned: <template> <!-- Place 1 --> <div @click="$log"> <!-- Place 2 --> {{ $log }} <!-- Place 3 --> {{ $log('foo') }} </div> </template> <script> import Vue from 'vue' // Place 4 Vue.prototype.$log('foo') export default { created() { // Place 5 this.$log('foo') }, } </script> Some additional information that might help: ESLint - How to restrict property of this no-restricted-syntax vue/no-restricted-syntax 回答1: After digging into

ESLint & Vue - How to ban the use of `$log`?

≡放荡痞女 提交于 2021-02-07 20:40:49
问题 Origin of $log : Vue.prototype.$log = console.log Places to be banned: <template> <!-- Place 1 --> <div @click="$log"> <!-- Place 2 --> {{ $log }} <!-- Place 3 --> {{ $log('foo') }} </div> </template> <script> import Vue from 'vue' // Place 4 Vue.prototype.$log('foo') export default { created() { // Place 5 this.$log('foo') }, } </script> Some additional information that might help: ESLint - How to restrict property of this no-restricted-syntax vue/no-restricted-syntax 回答1: After digging into

Failing to browse React application deployed to Heroku

筅森魡賤 提交于 2021-02-07 18:38:20
问题 When wirite https://tictactoesko.herokuapp.com/ in a browser then I recive folowing error message: Failed to compile ./src/index.js Module build failed: Error: Cannot find module 'eslint/lib/formatters/stylish' My index.js look like this import React from 'react' import ReactDOM from 'react-dom' import './index.css' import Game from './Game' ReactDOM.render(, document.getElementById('root')) My package.json looks like this { "name": "tic-tac-toe", "version": "0.1.0", "private": true,