ember-template-lint / eslint-plugin-hbs

Plugin for eslint which checks inline hbs templates
ISC License
18 stars 8 forks source link

ember-template-lint "overrides" config does not work with eslint-plugin-hbs #37

Closed tstewart15 closed 3 years ago

tstewart15 commented 4 years ago

I'm trying to override specific ember-template-lint rules for certain files/directories in my repo, using the ember-template-lint "overrides" config prop.

This does not seem to work.

Is there another method of overriding ember-template-lint rules for specific files/directories that works with eslint-plugin-hbs? Or do we need to fix this issue?

rwjblue commented 4 years ago

Ya, I think we'll need to make changes to address.

jaydgruber commented 4 years ago

I ran into this issue where I wanted to be able to enable no-bare-strings on app templates files, but ignore it on inline templates in test files.

I ended up doing the following (pretty much the inverse of how I would normally do this):

// .template-lintrc.js
module.exports = {
  rules: {
    'no-bare-strings': false,
  },
  overrides: [
    {
      files: ['**/*.hbs'],
      rules: {
        'no-bare-strings': true,
      }
    },
  ],
};
tstewart15 commented 3 years ago

@rwjblue @bobisjan The issue does not appear fixed after upgrading to version 2.13.0. Setting the following does not correctly ignore the listed overrides files:

module.exports = {
  rules: {
    'no-bare-strings': true,
  },
  overrides: [
    // Allow non-translated strings in fixtures/ and HealthCheck
    {
      files: [
        '**/test-js/glimmer/fixtures/**',
        '**/HealthCheck.js',
      ],
      rules: {
        'no-bare-strings': false,
      },
    },
  ],
};