Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unicorn/string-content rule #439

Merged
merged 2 commits into from Mar 11, 2020
Merged

Add unicorn/string-content rule #439

merged 2 commits into from Mar 11, 2020

Conversation

sindresorhus
Copy link
Member

@fregante
Copy link
Member

fregante commented Mar 9, 2020

I’m unsure. Would this rule require exceptions every time ... on Commit is used in a GraphQL query? Could it use tags to automatically determine code strings to skip?

gql` repo() { ... on Commit {}}`

@sindresorhus
Copy link
Member Author

I think the rule should be excluded on gql by default as it's code in a string and not a pure string.

// @fisker

@sindresorhus
Copy link
Member Author

@fregante The rule has ' => built-in. Should we also do "foo" => “foo”? The complication is that the changed quotes are different characters for left and right.

@sindresorhus sindresorhus merged commit 5a22b77 into master Mar 11, 2020
@sindresorhus sindresorhus deleted the string-content branch March 11, 2020 10:35
@fregante
Copy link
Member

I think this rule is something not all projects can handle by default. CSS selectors have lots of " and '. Let's start with ' for now

@isghe
Copy link

isghe commented Mar 13, 2020

It's really dangerous; it breaks a program I am working on:
from:

'readMessage(:queue, :id, \'ZCP\', :cursor)';

to

'readMessage(:queue, :id, ’ZCP’, :cursor)';

breaking a query to oracle db.

I think it shouldn't change the content of a string.

@tusbar
Copy link

tusbar commented Mar 18, 2020

Agreed, this rule should be reverted as it breaks any string that’s not displayable text.

@niftylettuce
Copy link

niftylettuce commented Mar 31, 2020

Agreed, same exact thing happened on my end that @isghe experienced.

@niftylettuce
Copy link

Please resolve this, I'm seeing stuff like this get replaced as well:

package-scripts.js (nps)

-pretestMongo: "mongo forwardemail_test --eval 'db.dropDatabase()'",
+pretestMongo: 'mongo forwardemail_test --eval ’db.dropDatabase()’',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants