Error unexpected string concatenation prefer template

prefer-template doesn't consider unary expressions in string concat as warning #3589 Comments dashed commented Aug 30, 2015 prefer-template doesn't

prefer-template doesn’t consider unary expressions in string concat as warning #3589

Comments

dashed commented Aug 30, 2015

prefer-template doesn’t consider unary expressions in string concat as warning.

It can be rewritten as the following; but prefer-template doesn’t emit a warning:

The text was updated successfully, but these errors were encountered:

eslintbot commented Aug 30, 2015

Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you’ve included all of the information we need to help you.

Reporting a bug? Please be sure to include:

  1. The version of ESLint you are using (run eslint -v )
  2. The source code that caused the problem
  3. The configuration you’re using (for the rule or your entire config file)
  4. The actual ESLint output complete with line numbers

Requesting a new rule? Please be sure to include:

  1. The use case for the rule — what is it trying to prevent or flag?
  2. Whether the rule is trying to prevent an error or is purely stylistic
  3. Why you believe this rule is generic enough to be included

Requesting a feature? Please be sure to include:

  1. The problem you want to solve (don’t mention the solution)
  2. Your take on the correct solution to problem

Including this information in your issue helps us to triage it and get you a response as quickly as possible.

Источник

Prefer-template multiline #3507

Comments

Cellule commented Aug 24, 2015

Sometimes we break string in mulitple lines for lisibility like

The rule warns us to use template string when this is not needing and defeats the purpose.
Right now, there is a work around to add 2 template strings like

But I don’t know if this is something we want/should keep. see #3506

The text was updated successfully, but these errors were encountered:

eslintbot commented Aug 24, 2015

Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you’ve included all of the information we need to help you.

Reporting a bug? Please be sure to include:

  1. The version of ESLint you are using (run eslint -v )
  2. The source code that caused the problem
  3. The configuration you’re using (for the rule or your entire config file)
  4. The actual ESLint output complete with line numbers

Requesting a new rule? Please be sure to include:

  1. The use case for the rule — what is it trying to prevent or flag?
  2. Whether the rule is trying to prevent an error or is purely stylistic
  3. Why you believe this rule is generic enough to be included

Requesting a feature? Please be sure to include:

  1. The problem you want to solve (don’t mention the solution)
  2. Your take on the correct solution to problem

Including this information in your issue helps us to triage it and get you a response as quickly as possible.

Источник

Fix all out-of-the-box ESLint errors #2157

Comments

samlasalle commented Aug 17, 2016 •

I have installed the angular-fullstack generator as per the instructions however I am getting a large amount of errors, most of them telling me that ‘angular’ is not defined, or that the expected indentation doesn’t match the generated indentation.

I have previously gotten this working on a different EC2 instance with none of these issues and I have no idea what I’ve done differently.

I can still enter the URL on my browser and the title is returned to that tab, and in the CLI where gulp serve is running it shows three GET requests with code 200, however no pages are being served. I am unsure what to do.

Attached is my output from gulp serve:

  • I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
Item Version
generator-angular-fullstack 4.0.1
Node 6.2.2
npm 3.9.5
Operating System Ubuntu 14.04
Item Answer
Transpiler Babel
Markup HTML / Pug
CSS CSS / LESS / SCSS / Stylus
Router ui-router
Client Tests Jasmine / Mocha
DB MongoDB
Auth Y

The text was updated successfully, but these errors were encountered:

Источник

Rule «no-useless-concat» reports false positive #3575

Comments

steffenweber commented Aug 29, 2015

If I’m not mistaken then this concatenation is not useless because number is not a string.

The text was updated successfully, but these errors were encountered:

eslintbot commented Aug 29, 2015

Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you’ve included all of the information we need to help you.

Reporting a bug? Please be sure to include:

  1. The version of ESLint you are using (run eslint -v )
  2. The source code that caused the problem
  3. The configuration you’re using (for the rule or your entire config file)
  4. The actual ESLint output complete with line numbers

Requesting a new rule? Please be sure to include:

  1. The use case for the rule — what is it trying to prevent or flag?
  2. Whether the rule is trying to prevent an error or is purely stylistic
  3. Why you believe this rule is generic enough to be included

Requesting a feature? Please be sure to include:

  1. The problem you want to solve (don’t mention the solution)
  2. Your take on the correct solution to problem

Including this information in your issue helps us to triage it and get you a response as quickly as possible.

Источник

Quotes Refuses to Honor es6 Templates #7273

Comments

joshrhoades commented Sep 28, 2016 •

Ok, trolled through similar issues, and they all seem to end up being solved with the addition of allowTemplateLiterals rule for quotes , but that isn’t working for me and I think I’m about out of options or missing something so blatantly obvious that I will literally mock a kangaroo just to cause him to punch me, so here we are typing things into the webernets as a last-ditch effort.

It seems as perhaps there is some Bermudian Traingulan (what, yeah I said it) thing where a confluence of rules are combined to make one of the pieces tip over. That or I am missing something ridiculous despite my efforts, or perhaps there is a true issue lurking.

The code itself is fine, it executes properly with no errors, nothing is off in that sense.

This happens with single or double , and whether or not I include the props for allowEscape or allowTemplateLiterals in any combination, including omitting them.

If I run only the recommended rules, no such errors are reported, though that shouldn’t be surprising.

Tell us about your environment

  • ESLint Version: @3.6.0 (via rollup-plugin-eslint @3.0.0)
  • Node Version: @5.6.0
  • npm Version: @3.10.8

What parser (default, Babel-ESLint, etc.) are you using?
Default

Please show your full configuration: eslintrc.json

What did you do? Please include the actual source code causing the issue.

Additionally, in another file, this perfectly valid template string:

Reports this linter error:

What did you expect to happen?
Shouldn’t have seen linter errors.

What actually happened? Please include the actual, raw output from ESLint.
No other errors are reported for these lines or files.

The text was updated successfully, but these errors were encountered:

Источник

Posted By: Anonymous
<template>
<label>Firstname: </label><input type="text" v-model="user.firstName">
    <br/>
    <label>Lastname: </label><input type="text" v-model="user.lastName">
    <h3>{{fullName}}</h3>
</template>

<script>
export default {
    name: 'homepage',
    data() {
      return {
        title: 'Hello',
        user: {
          firstName: 'name',
          lastName: 'surname',
        },
        showName: false,
        items: [
          {
            title: 'Item one',
          },
          {
            title: 'Item two',
          },
          {
            title: 'Item three',
          },
        ],
      };
    },
    computed: {
      fullName() {
        return this.user.firstName + ' ' + this.user.lastName;
      },
    },
  };
</script>

I am trying to return a string value in fullName() function but when I add + ' ' + ...., I get Unexpected string concatenation(prefer-template) error. If I just return this.user.firstName; it works. How can I return this.user.firstName + ' ' + this.user.lastName;?

Solution

This is a lint error. There is nothing inherently wrong from a JavaScript perspective with this.user.firstName + ' ' + this.user.lastName;. However your linter is setup to show an error when it finds string concatenation. Simply use a template string instead, as it is now the preferred method.

`${this.user.firstName} ${this.user.lastName}`

If you would prefer to use concatenation. Lookup how to modify your linters rule, for example here is how to do it for eslint (which I believe you are using).

Answered By: Anonymous

Related Articles

  • Vue js vuecli3 application does not work in ie11 (babel is…
  • v-model not updating data when using a v-for in Vue
  • Is CSS Turing complete?
  • PHP parse/syntax errors; and how to solve them
  • How to prevent scrolling the whole page?
  • Sort array for two properties Vuejs
  • Combining items using XSLT Transform
  • Form field border-radius is not working only on the last…
  • Combining Ember Table with Ember Data
  • Vue.js — How to implement Computed properties on objects of…

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

tags: JavaScript  Vue  ES6  

The error is as follows:

Reason: ESLint recommends using ES6 Template String to splice strings, but not+number.

Solution:

`I am the string part, ${I am the parameter part}, I am the string part`

Official document: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/template_strings


Intelligent Recommendation

C# string concatenation

There are four commonly used C# string connection methods: StringBuilder, +, string.Format, List<string>. 1.+ way string sql = «update tableName set int1=» + int1.ToString() + «,i…

Python notes-string concatenation

  String concatenation +    1.JavaOther basic data types andstringdo+, Automatically converted tostringdeal with   PythonThis feature is not available in. Need to be converted tostringDo spl…

Topic 1206: String concatenation

Title description: Do not borrow any string library functions to accept two strings without redundancy, and then connect them without redundancy. enter: Each line contains two strings, and the length …

More Recommendation

String concatenation operation in sqlite

I helped a friend to make a website. The database uses sqlite. I didn’t pay attention when writing the program. When I uploaded the file, I didn’t save it to the suffix. As a result, the i…

Longest concatenation of string

An interview question I saw: There are n lengths of m+1If the last m characters of a string match the first m characters of a string, the two strings can be joined. How long can these n strings be joi…

Related Posts

  • sql concatenation string
  • Mysql string concatenation
  • Multi-line string concatenation
  • Ternary operator, string concatenation
  • SQL Where string concatenation
  • Text processing-string concatenation
  • SQL string concatenation
  • Python string concatenation
  • String concatenation in JavaScript
  • JS concatenation string array

Popular Posts

  • C ++ _ 2_ improve
  • Html+jquery mobile
  • Knowledge learned when reading SQLMAP source code — check the operating environment
  • Iterative method and merged function
  • POJ_1185_ artillery position DP + state compression
  • Django — Verification Code Features Implementation
  • Approximate Research
  • The Road to ACM Questions (9) Number Theory-Reverse Order Group Exchange Seats
  • Enter the three -edge (integer) of the triangle to determine whether it can form a triangle if it can form a triangle, and then determine what kind of triangle (right angle, ordinary, waiting waist, etc.) if it cannot be output «error»
  • node.js-cancelled because Node.js is unresponsive

Recommended Posts

  • Simple factory pattern and factory method pattern
  • jquery 04
  • CF1545B AquaMoon and Chess
  • Recurns in JavaScript
  • OpenStack platform
  • Python object-oriented (primary)
  • java (jxl) generates a new excel return based on the excel template
  • The form is submitted, and jQuery validates the input
  • IOS common classification category
  • JDBC connect to the database

Related Tags

  • mysql
  • sql server
  • sql
  • Java
  • SQL
  • python
  • Python
  • javascript
  • [1] .Net & C#
  • sql notes

Понравилась статья? Поделить с друзьями:
  • Error unexpected rcode refused
  • Error unexpected matlab operator
  • Error unexpected matlab expression
  • Error unexpected local declaration in procedure body
  • Error unexpected junk after else statement at 1