diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 97f0236bbb5..ae3bd97e507 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -86,8 +86,9 @@ jobs: if: ${{ always() }} run: | yarn ember-template-lint \ - app/assets/javascripts \ - plugins/**/assets/javascripts + --no-error-on-unmatched-pattern \ + "app/assets/javascripts/**/*.hbs" \ + "plugins/**/assets/javascripts/**/*.hbs" - name: English locale lint (core) if: ${{ always() }} diff --git a/.prettierignore b/.prettierignore index 50cabc43a52..fff97dce442 100644 --- a/.prettierignore +++ b/.prettierignore @@ -22,4 +22,10 @@ app/assets/javascripts/discourse/tests/fixtures spec/ node_modules/ dist/ +tmp/ + **/*.rb +**/*.hbs +**/*.html +**/*.json +**/*.md diff --git a/.template-lintrc.js b/.template-lintrc.js index 604f813f523..e3fc07b48d6 100644 --- a/.template-lintrc.js +++ b/.template-lintrc.js @@ -1,58 +1,9 @@ module.exports = { - extends: "recommended", - ignore: ["**/*.raw"], + plugins: ["ember-template-lint-plugin-discourse"], + extends: "discourse:recommended", rules: { - "block-indentation": true, - "deprecated-render-helper": true, - "eol-last": "always", - "linebreak-style": true, - "link-rel-noopener": "strict", - "no-abstract-roles": true, - "no-args-paths": true, - "no-attrs-in-components": true, - "no-debugger": true, - "no-duplicate-attributes": true, - "no-extra-mut-helper-argument": true, - "no-html-comments": true, - "no-index-component-invocation": true, - "no-inline-styles": false, - "no-input-block": true, - "no-input-tagname": true, - "no-implicit-this": { - allow: [ - 'loading-spinner' - ] - }, - "no-invalid-interactive": true, - "no-invalid-link-text": true, - "no-invalid-meta": true, - "no-invalid-role": true, - "no-log": true, - "no-negated-condition": true, - "no-nested-interactive": true, - "no-multiple-empty-lines": true, - "no-obsolete-elements": true, - "no-outlet-outside-routes": true, - "no-partial": true, - "no-positive-tabindex": false, - "no-quoteless-attributes": true, - "no-shadowed-elements": true, - "no-trailing-spaces": true, - "no-triple-curlies": true, - "no-unbound": true, - "no-unnecessary-concat": true, - "no-unnecessary-component-helper": true, - "no-unused-block-params": true, - quotes: "double", - "require-button-type": true, - "require-iframe-title": true, - "require-valid-alt-text": false, - "self-closing-void-elements": true, - "simple-unless": true, - "style-concatenation": true, - "table-groups": true, - "link-href-attributes": false, + "no-capital-arguments": false, // TODO: we extensively use `args` argument name "no-curly-component-invocation": { allow: [ // These are helpers, not components @@ -64,5 +15,8 @@ module.exports = { "mobile-directory-item-label", ], }, + "no-implicit-this": { + allow: ["loading-spinner"], + }, }, }; diff --git a/app/assets/javascripts/admin/addon/components/ace-editor.js b/app/assets/javascripts/admin/addon/components/ace-editor.js index 88c46ed9c57..58c1d0b8aa8 100644 --- a/app/assets/javascripts/admin/addon/components/ace-editor.js +++ b/app/assets/javascripts/admin/addon/components/ace-editor.js @@ -5,7 +5,8 @@ import I18n from "I18n"; import { bind, observes } from "discourse-common/utils/decorators"; import { on } from "@ember/object/evented"; -const COLOR_VARS_REGEX = /\$(primary|secondary|tertiary|quaternary|header_background|header_primary|highlight|danger|success|love)(\s|;|-(low|medium|high))/g; +const COLOR_VARS_REGEX = + /\$(primary|secondary|tertiary|quaternary|header_background|header_primary|highlight|danger|success|love)(\s|;|-(low|medium|high))/g; export default Component.extend({ mode: "css", diff --git a/app/assets/javascripts/admin/addon/controllers/admin-dashboard-reports.js b/app/assets/javascripts/admin/addon/controllers/admin-dashboard-reports.js index 51437f22f04..09741ede964 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-dashboard-reports.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-dashboard-reports.js @@ -12,7 +12,7 @@ export default Controller.extend({ "filter", "siteSettings.dashboard_hidden_reports" ) - filterReports(reports, filter) { + filteredReports(reports, filter) { if (filter) { filter = filter.toLowerCase(); reports = reports.filter((report) => { diff --git a/app/assets/javascripts/admin/addon/routes/admin-customize-themes.js b/app/assets/javascripts/admin/addon/routes/admin-customize-themes.js index 5eeae3a5516..8734675eff2 100644 --- a/app/assets/javascripts/admin/addon/routes/admin-customize-themes.js +++ b/app/assets/javascripts/admin/addon/routes/admin-customize-themes.js @@ -32,8 +32,9 @@ export default Route.extend({ actions: { installModal() { - const currentTheme = this.controllerFor("adminCustomizeThemes.show") - .model; + const currentTheme = this.controllerFor( + "adminCustomizeThemes.show" + ).model; if (currentTheme && currentTheme.warnUnassignedComponent) { showUnassignedComponentWarning(currentTheme, (result) => { if (!result) { diff --git a/app/assets/javascripts/admin/addon/routes/admin-users-list-show.js b/app/assets/javascripts/admin/addon/routes/admin-users-list-show.js index d4f71e6120c..80eb675049d 100644 --- a/app/assets/javascripts/admin/addon/routes/admin-users-list-show.js +++ b/app/assets/javascripts/admin/addon/routes/admin-users-list-show.js @@ -12,8 +12,9 @@ export default DiscourseRoute.extend({ const routeName = "adminUsersList.show"; if (transition.targetName === routeName) { - const params = transition.routeInfos.find((a) => a.name === routeName) - .params; + const params = transition.routeInfos.find( + (a) => a.name === routeName + ).params; const controller = this.controllerFor(routeName); if (controller) { controller.setProperties({ diff --git a/app/assets/javascripts/admin/addon/services/admin-tools.js b/app/assets/javascripts/admin/addon/services/admin-tools.js index a90df7de8ee..17266be8229 100644 --- a/app/assets/javascripts/admin/addon/services/admin-tools.js +++ b/app/assets/javascripts/admin/addon/services/admin-tools.js @@ -46,9 +46,10 @@ export default Service.extend({ }); controller.setProperties({ postId: opts.postId, postEdit: opts.postEdit }); - return (user.adminUserView - ? Promise.resolve(user) - : AdminUser.find(user.get("id")) + return ( + user.adminUserView + ? Promise.resolve(user) + : AdminUser.find(user.get("id")) ).then((loadedUser) => { controller.setProperties({ user: loadedUser, diff --git a/app/assets/javascripts/admin/addon/templates/api-keys-new.hbs b/app/assets/javascripts/admin/addon/templates/api-keys-new.hbs index 3c9c5310d05..91c0800098e 100644 --- a/app/assets/javascripts/admin/addon/templates/api-keys-new.hbs +++ b/app/assets/javascripts/admin/addon/templates/api-keys-new.hbs @@ -16,7 +16,7 @@ {{else}} - + @@ -76,7 +76,7 @@ {{#each act.params as |p|}} - + {{/each}} diff --git a/app/assets/javascripts/admin/addon/templates/api-keys-show.hbs b/app/assets/javascripts/admin/addon/templates/api-keys-show.hbs index 43ae76c3ce7..f1db529b84a 100644 --- a/app/assets/javascripts/admin/addon/templates/api-keys-show.hbs +++ b/app/assets/javascripts/admin/addon/templates/api-keys-show.hbs @@ -11,7 +11,7 @@ {{#if this.editingDescription}} - + {{else}} {{if this.model.description this.model.description (i18n "admin.api.no_description")}} diff --git a/app/assets/javascripts/admin/addon/templates/badges-show.hbs b/app/assets/javascripts/admin/addon/templates/badges-show.hbs index 60948580a6b..520790be3b3 100644 --- a/app/assets/javascripts/admin/addon/templates/badges-show.hbs +++ b/app/assets/javascripts/admin/addon/templates/badges-show.hbs @@ -3,14 +3,14 @@
{{#if this.readOnly}} - +

{{i18n "admin.badges.read_only_setting_help"}}

{{else}} - + {{/if}}
@@ -56,28 +56,28 @@
{{#if this.buffered.system}} -