robatwilliams / es-compat

Check JavaScript code compatibility with target runtime environments
MIT License
64 stars 13 forks source link

Allow overriding of rules #80

Closed lukasIO closed 1 year ago

lukasIO commented 1 year ago

hi!

In an attempt to find a workaround for #72, I was wondering if it's an option to allow additional lint rules to be passed into ecmascript-compat/compat in addition to polyfills ? That way I could work around the missing BigInt polyfill by declaring

'ecmascript-compat/compat': [
      'error',
      {
        rules: {
          'es-x/no-bigint': 'warn',
        },
        polyfills: [
          'globalThis',
        ],
      },
    ],
robatwilliams commented 1 year ago

Hi.

No, I want to keep the rules as an implementation detail without any exposure, so I have the option to change (e.g. custom rules) in future.

It doesn't seem too difficult a task to solve #72, either in the es-x plugin (preferred) or in this project. However I'm not spending time on this project at the moment or in the near future.

Possible options for you in the meantime:

  1. Use patch-package (or the builtin equivalent in yarn) to make changes you need to the plugin (as previously suggested)
  2. Use patch-package to add a lint ignore comment on the feature test line