question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quoted object property ignores camelcase rule

See original GitHub issue

Tell 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kaicataldocommented, Oct 18, 2017

I agree, I think this is a bug.

0reactions
darrenkleincommented, Dec 4, 2018

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:

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to be implemented after 90 days tend to never be implemented, and as such, we close those issues https://eslint.org/docs/maintainer-guide/issues#when-to-close-an-issue. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eslint/eslint/issues/9470#issuecomment-431915918, or mute the thread https://github.com/notifications/unsubscribe-auth/AGbnNeNODHgF3FTnSx1mrfKiLSpoiuZyks5ungcsgaJpZM4P8y3W .

– Best, Darren Klein darren.a.klein@gmail.com http://darrenklein.github.io/

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found