totallymoney / eslint-plugin-prefer-smart-quotes

📏 Prefer the use of curly quote/apostrophe characters
https://www.npmjs.com/package/eslint-plugin-prefer-smart-quotes
MIT License
4 stars 1 forks source link

Can I turn off the `prefer-smart-quotes/prefer` rule? #6

Closed ronny1020 closed 1 year ago

ronny1020 commented 1 year ago

Hi, I would like to turn off this rule in my test file. And I add this rule to the overrides in eslintrc file with off. I think it's not working with off. Could this feature be added to this? Thanks.

ljbc1994 commented 1 year ago

Hi @ronny1020,

I've just tested it using the off rule and it should be working. Could I see the eslintrc file or at least part of it to have a look?

A suggestion would be if you have it the same as below, try restarting the ESLint Server

eslint config

module.exports = {
  root: true,
  plugins: ['prefer-smart-quotes'],
  rules: {
    'prefer-smart-quotes/prefer': ['error', 'all'],
  },
  overrides: [
    {
      files: ['*.ts', '*.tsx'],
      rules: {
         'prefer-smart-quotes/prefer': 'off',
      },
    },
  ],
}

ts file - Doesn't error

const test = 'Hello my name is "Bob"'

js file - Does error

const test = 'Hello my name is "Bob"'
ronny1020 commented 1 year ago

I'm very sorry. It works perfectly now. I'm not sure what stupid mistake I had done. Anyway, thanks for your reply.

ljbc1994 commented 1 year ago

I'm very sorry. It works perfectly now. I'm not sure what stupid mistake I had done. Anyway, thanks for your reply.

No worries at all!