Quoted object property ignores camelcase rule
See original GitHub issueTell us about your environment
- ESLint Version: 4.7.0
- Node Version: 6.11.1
- npm Version: 4.0.5
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration:
Configuration
{
"env": {
"es6": true,
"browser": true,
"node": true
},
"parser": "babel-eslint",
"rules": {
"array-bracket-newline": 0,
"array-element-newline": 0,
"arrow-body-style": 0,
"arrow-parens": [0, "as-needed"],
"block-spacing": 1,
"brace-style": 1,
"camelcase": 1,
"callback-return": 1,
"capitalized-comments": 0,
"class-methods-use-this": 1,
"comma-dangle": 1,
"comma-spacing": 1,
"consistent-return": 1,
"consistent-this": 1,
"curly": 1,
"dot-location": [0, "property"],
"eol-last": 0,
"eqeqeq": 1,
"func-names": [0, "as-needed"],
"global-require": 0,
"id-length": 0,
"indent": 0,
"init-declarations": 0,
"key-spacing": 1,
"keyword-spacing": 1,
"line-comment-position": 0,
"max-len": 0,
"max-lines": 0,
"max-params": 0,
"max-statements": 0,
"multiline-ternary": 1,
"newline-per-chained-call": 0,
"no-alert": 0,
"no-console": 1,
"no-else-return": 1,
"no-extra-parens": [1, "all", { ignoreJSX: "all" }],
"no-extra-semi": 1,
"no-inline-comments": 0,
"no-lonely-if": 0,
"no-magic-numbers": 0,
"no-mixed-spaces-and-tabs": [0, "smart-tabs"],
"no-negated-condition": 0,
"no-plusplus": [0, {"allowForLoopAfterthoughts": true}],
"no-process-env": 0,
"no-sync": 0,
"no-tabs": 0,
"no-ternary": 0,
"no-trailing-spaces": 1,
"no-undefined": 0,
"no-undef-init": 1,
"no-unneeded-ternary": 1,
"no-unused-expressions": [2, {"allowTernary": true}],
"no-unused-vars": 2,
"no-useless-escape": 1,
"no-useless-return": 1,
"object-curly-newline": 0,
"object-curly-spacing": 0,
"object-property-newline": 1,
"object-shorthand": 0,
"one-var": 1,
"operator-assignment": 1,
"operator-linebreak": 0,
"padded-blocks": 0,
"prefer-arrow-callback": 1,
"prefer-const": 1,
"prefer-destructuring": 0,
"prefer-template": 1,
"quotes": 1,
"quote-props": 1,
"require-jsdoc": 0,
"semi": 0,
"sort-imports": 0,
"sort-keys": 0,
"sort-vars": 0,
"space-before-blocks": 1,
"space-before-function-paren": 0,
"space-in-parens": 1,
"space-infix-ops": 1,
"spaced-comment": 1,
"space-unary-ops": 1
}
}
What did you do? Please include the actual source code causing the issue.
user = {
"first_name": req.query.firstname,
"last_name": req.query.lastname,
"email": req.query.email
}
What did you expect to happen?
I expected this code to produce a warning, since the user
object properties are not camelcased. However, ESLint returned no warnings or errors. I found that if I unquoted the properties, ESLint would return camelcase warnings.
What actually happened? Please include the actual, raw output from ESLint. The code as-is produced no errors/warnings. However, if I unquoted the properties, ESLint returned
42:5 warning Unquoted property 'first_name' found quote-props
42:5 warning Identifier 'first_name' is not in camel case camelcase
43:5 warning Unquoted property 'last_name' found quote-props
43:5 warning Identifier 'last_name' is not in camel case camelcase
44:5 warning Unquoted property 'email' found quote-props
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Can't specify object keys that aren't camel case, even ... - GitHub
It appears I'm going to have to create pragmas to ignore some rules. ... Can't specify object keys that aren't camel case, even...
Read more >quote-props - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >naming-convention | typescript-eslint
This rule accepts an array of objects, with each object describing a different naming convention. Each property will be described in detail below....
Read more >ignore classname in `naming-convention` - typescript
A workaround would be to follow the documentation's example on ignoring properties that require quotes with e.g. { "selector": "property" ...
Read more >How to customize property names and values with System ...
Customize individual property names; Use camel case for all JSON property names ... If a property of an object to be serialized is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree, I think this is a bug.
If I get some free time, I’ll try to pick this up and open a PR…
On Mon, Oct 22, 2018 at 1:58 PM Nicholas C. Zakas notifications@github.com wrote:
– Best, Darren Klein darren.a.klein@gmail.com http://darrenklein.github.io/