ember-template-lint
Version:
Linter for Ember or Handlebars templates.
136 lines (133 loc) • 5.79 kB
JavaScript
export default {
rules: {
'builtin-component-arguments': 'error',
'deprecated-inline-view-helper': 'error',
'deprecated-render-helper': 'error',
'link-href-attributes': 'error',
'link-rel-noopener': 'error',
'no-abstract-roles': 'error',
'no-accesskey-attribute': 'error',
'no-action': 'error',
'no-action-on-submit-button': 'error',
'no-args-paths': 'error',
'no-arguments-for-html-elements': 'error',
'no-aria-hidden-body': 'error',
'no-aria-unsupported-elements': 'error',
'no-array-prototype-extensions': 'error',
'no-at-ember-render-modifiers': 'error',
'no-attrs-in-components': 'error',
'no-autofocus-attribute': 'error',
'no-block-params-for-html-elements': 'error',
'no-builtin-form-components': 'error',
'no-capital-arguments': 'error',
'no-class-bindings': 'error',
'no-curly-component-invocation': 'error',
'no-debugger': 'error',
'no-duplicate-attributes': 'error',
'no-duplicate-id': 'error',
'no-duplicate-landmark-elements': 'error',
'no-empty-headings': 'error',
'no-extra-mut-helper-argument': 'error',
'no-forbidden-elements': 'error',
'no-heading-inside-button': 'error',
'no-html-comments': 'error',
'no-implicit-this': 'error',
'no-index-component-invocation': 'error',
'no-inline-styles': 'error',
'no-input-block': 'error',
'no-input-tagname': 'error',
'no-invalid-aria-attributes': 'error',
'no-invalid-interactive': 'error',
'no-invalid-link-text': 'error',
'no-invalid-link-title': 'error',
'no-invalid-meta': 'error',
'no-invalid-role': 'error',
'no-link-to-positional-params': 'error',
'no-link-to-tagname': 'error',
'no-log': 'error',
'no-negated-condition': 'error',
'no-nested-interactive': 'error',
'no-nested-landmark': 'error',
'no-nested-splattributes': 'error',
'no-obscure-array-access': 'error',
'no-obsolete-elements': 'error',
'no-outlet-outside-routes': 'error',
'no-partial': 'error',
'no-passed-in-event-handlers': 'error',
'no-pointer-down-event-binding': 'error',
'no-positional-data-test-selectors': 'error',
'no-positive-tabindex': 'error',
'no-potential-path-strings': 'error',
'no-quoteless-attributes': 'error',
'no-redundant-fn': 'error',
'no-redundant-role': 'error',
'no-route-action': 'error',
'no-scope-outside-table-headings': 'error',
'no-shadowed-elements': 'error',
'no-triple-curlies': 'error',
'no-unbalanced-curlies': 'error',
'no-unbound': 'error',
'no-unknown-arguments-for-builtin-components': 'error',
'no-unnecessary-component-helper': 'error',
'no-unnecessary-curly-parens': 'error',
'no-unnecessary-curly-strings': 'error',
'no-unsupported-role-attributes': 'error',
'no-unused-block-params': 'error',
'no-valueless-arguments': 'error',
'no-whitespace-for-layout': 'error',
'no-whitespace-within-word': 'error',
'no-with': 'error',
'no-yield-only': 'error',
'no-yield-to-default': 'error',
'require-aria-activedescendant-tabindex': 'error',
'require-button-type': 'error',
'require-context-role': 'error',
'require-has-block-helper': 'error',
'require-iframe-title': 'error',
'require-input-label': 'error',
'require-lang-attribute': 'error',
'require-mandatory-role-attributes': 'error',
'require-media-caption': 'error',
'require-presentational-children': 'error',
'require-valid-alt-text': 'error',
'require-valid-named-block-naming-format': 'error',
'simple-modifiers': 'error',
'simple-unless': 'error',
'splat-attributes-only': 'error',
'style-concatenation': 'error',
'table-groups': 'error',
},
overrides: [
{
files: ['**/*.gjs', '**/*.gts'],
rules: {
// in gjs/gts, curly-component-invocation, and no-implicit-this were incorrectly triggered,
// because {{foo}}, which is ambiguous in loose-mode templates could have "foo" defined in JS scope.
// For example:
//
// const foo = "hello there";
// <template>{{foo}}</template>
//
// template-lint *only* looks at what is between the <template> tags, and doesn't know about the surrounding context.
// so these two rules are regularly false-negatives.
// additionally, because eslint-plugin-ember looks at the intermediate/transformed code of <template>,
// eslint is responsible for reporting when "foo" would be undefined (which is the only thing it can be (other than defined)
// in strict mode -- there is no implicit this ever)
'no-curly-component-invocation': 'off',
'no-implicit-this': 'off',
// This rule is not enabled here (but it is enabled in the "stylistic" preset). However, the rule is
// essentially malfunctioning in gjs/gts context, so it makes sense to always add this override to
// disable it for gjs/gts files, in case the rule is enabled. Ideally, a better fix would be to give
// the rule enough information to determine the context, so it can disable itself, but that would
// require a bigger overhaul. In the meantime, this will prevent a broken experience for <template>
// tags. See https://github.com/ember-template-lint/ember-template-lint/issues/2436.
'modifier-name-case': 'off',
// These rules have expectations for global components that are not valid in gjs/gts.
// By disabling them we run the risk of false negatives but this is better than false positives.
'builtin-component-arguments': 'off',
'no-builtin-form-components': 'off',
'no-unknown-arguments-for-builtin-components': 'off',
},
},
],
};