lancetw/react-isomorphic-bundle

View on GitHub
src/shared/i18n/zh-hant-cn.js

Summary

Maintainability
F
1 wk
Test Coverage

File zh-hant-cn.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable max-len */
module.exports = {
  http: {
    'error': {
      '401': {
Severity: Minor
Found in src/shared/i18n/zh-hant-cn.js - About 4 hrs to fix

    Unnecessarily quoted property 'lv2' found.
    Open

          'lv2': '5 公里',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'lv5' found.
    Open

          'lv5': '50 公里'
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property '401' found.
    Open

          '401': {
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'title' found.
    Open

            'title': '身份验证已逾期',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'lng' found.
    Open

          'lng': '经度',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'my' found.
    Open

          'my': '我的位置',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'lv1' found.
    Open

          'lv1': '3 公里',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'attachments' found.
    Open

          'attachments': '提供附件下载',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'ocname' found.
    Open

          'ocname': {
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'text' found.
    Open

            'text': '代为发文请填入原始单位组织编号或名称(非必填)'
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'close' found.
    Open

          'close': '报名已截止',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'end' found.
    Open

          'end': '将结束于 ',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'search' found.
    Open

          'search': '搜寻',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'start' found.
    Open

          'start': ' 开始',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'noexist' found.
    Open

          'noexist': '本布告已删除。',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'text' found.
    Open

            'text': '請重新登入一次,謝謝'
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'lv3' found.
    Open

          'lv3': '10 公里',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'lv4' found.
    Open

          'lv4': '20 公里',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'tips' found.
    Open

          'tips': '为您的地点取个名称'
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'delete' found.
    Open

          'delete': {
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'update' found.
    Open

          'update': '更新',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'lat' found.
    Open

          'lat': '纬度',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'nomap' found.
    Open

          'nomap': '未提供位置资讯',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'edit' found.
    Open

          'edit': '编辑',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'error' found.
    Open

        'error': {
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'geo' found.
    Open

          'geo': '寻找我的位置',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'open' found.
    Open

          'open': '开放报名中',
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Unnecessarily quoted property 'this_year' found.
    Open

          'this_year': '今年'
    Severity: Minor
    Found in src/shared/i18n/zh-hant-cn.js by eslint

    require quotes around object literal property names (quote-props)

    Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

    var object1 = {
        property: true
    };
    
    var object2 = {
        "property": true
    };

    In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

    There are, however, some occasions when you must use quotes:

    1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
    2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

    Another example where quotes do matter is when using numeric literals as property keys:

    var object = {
        1e2: 1,
        100: 2
    };

    This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

    Rule Details

    This rule requires quotes around object literal property names.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires quotes around all object literal property names
    • "as-needed" disallows quotes around object literal property names that are not strictly required
    • "consistent" enforces a consistent quote style requires quotes around object literal property names
    • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

    Object option:

    • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
    • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
    • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    
    var object = {
        foo: "bar",
        baz: 42,
        "qux-lorem": true
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint quote-props: ["error", "always"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    as-needed

    Examples of incorrect code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    
    var object = {
        "a": 0,
        "0": 0,
        "true": 0,
        "null": 0
    };

    Examples of correct code for this rule with the "as-needed" option:

    /*eslint quote-props: ["error", "as-needed"]*/
    /*eslint-env es6*/
    
    var object1 = {
        "a-b": 0,
        "0x0": 0,
        "1e2": 0
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42,
        true: 0,
        0: 0,
        'qux-lorem': true
    };
    
    var object3 = {
        foo() {
            return;
        }
    };

    consistent

    Examples of incorrect code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        baz: 42
    };

    Examples of correct code for this rule with the "consistent" option:

    /*eslint quote-props: ["error", "consistent"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };
    
    var object3 = {
        foo: 'bar',
        baz: 42
    };

    consistent-as-needed

    Examples of incorrect code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        foo: "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        'foo': 'bar',
        'baz': 42
    };

    Examples of correct code for this rule with the "consistent-as-needed" option:

    /*eslint quote-props: ["error", "consistent-as-needed"]*/
    
    var object1 = {
        "foo": "bar",
        "baz": 42,
        "qux-lorem": true
    };
    
    var object2 = {
        foo: 'bar',
        baz: 42
    };

    keywords

    Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
    
    var x = {
        while: 1,
        volatile: "foo"
    };

    Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

    /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
    
    var x = {
        "prop": 1,
        "bar": "foo"
    };

    unnecessary

    Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

    /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
    
    var x = {
        "while": 1,
        "foo": "bar"  // Would normally have caused a warning
    };

    numbers

    Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

    /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
    
    var x = {
        100: 1
    }

    When Not To Use It

    If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    module.exports = {
      http: {
        'error': {
          '401': {
            'title': '身份验证已逾期',
    Severity: Major
    Found in src/shared/i18n/zh-hant-cn.js and 2 other locations - About 1 wk to fix
    src/shared/i18n/en.js on lines 2..341
    src/shared/i18n/zh-hant-tw.js on lines 2..341

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 1392.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status