DEV: Remove `.es6` extensions from core (#14912)

DEV: Remove .es6 extensions from core (#14912)

Still supported in plugins though.

diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml
index f1ca33a..ac5b712 100644
--- a/.github/workflows/linting.yml
+++ b/.github/workflows/linting.yml
@@ -61,11 +61,11 @@ jobs:
 
       - name: ESLint (core)
         if: ${{ always() }}
-        run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern app/assets/javascripts
+        run: yarn eslint app/assets/javascripts
 
       - name: ESLint (core plugins)
         if: ${{ always() }}
-        run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern plugins/**/{test,assets}/javascripts
+        run: yarn eslint plugins
 
       - name: Prettier
         if: ${{ always() }}
@@ -73,9 +73,9 @@ jobs:
           yarn prettier -v
           yarn prettier --list-different \
             "app/assets/stylesheets/**/*.scss" \
-            "app/assets/javascripts/**/*.{js,es6}" \
+            "app/assets/javascripts/**/*.js" \
             "plugins/**/assets/stylesheets/**/*.scss" \
-            "plugins/**/assets/javascripts/**/*.{js,es6}"
+            "plugins/**/assets/javascripts/**/*.js"
 
       - name: Ember template lint
         if: ${{ always() }}
diff --git a/lefthook.yml b/lefthook.yml
index b5e3a77..534e33e 100644
--- a/lefthook.yml
+++ b/lefthook.yml
@@ -5,14 +5,10 @@ pre-commit:
       glob: "*.rb"
       run: bundle exec rubocop --parallel {staged_files}
     prettier:
-      glob: "*.{js,es6}"
+      glob: "*.js"
       include: "app/assets/javascripts|test/javascripts"
       run: yarn pprettier --list-different {staged_files}
-    eslint-es6:
-      glob: "*.es6"
-      include: "app/assets/javascripts|test/javascripts"
-      run: yarn eslint --ext .es6 -f compact {staged_files}
-    eslint-js:
+    eslint:
       glob: "*.js"
       include: "app/assets/javascripts|test/javascripts"
       run: yarn eslint -f compact {staged_files}
@@ -52,23 +48,17 @@ lints:
     rubocop:
       run: bundle exec rubocop --parallel
     prettier:
-      glob: "*.{js,es6}"
+      glob: "*.js"
       include: "app/assets/javascripts|test/javascripts"
       run: yarn pprettier --list-different {all_files}
-    eslint-assets-es6:
-      run: yarn eslint --ext .es6 app/assets/javascripts
     eslint-assets-js:
       run: yarn eslint app/assets/javascripts
-    eslint-test-es6:
-      run: yarn eslint --ext .es6 test/javascripts
     eslint-test-js:
       run: yarn eslint test/javascripts
     eslint-plugins-assets:
-      run: yarn eslint --global I18n --ext .es6 plugins/**/assets/javascripts
+      run: yarn eslint plugins/**/assets/javascripts
     eslint-plugins-test:
-      run: yarn eslint --global I18n --ext .es6 plugins/**/test/javascripts
-    eslint-assets-tests:
-      run: yarn eslint app/assets/javascripts test/javascripts
+      run: yarn eslint plugins/**/test/javascripts
     i18n-lint:
       glob: "**/{client,server}.en.yml"
       run: bundle exec ruby script/i18n_lint.rb {all_files}
diff --git a/lib/tasks/docker.rake b/lib/tasks/docker.rake
index e078e5b..1e712e5 100644
--- a/lib/tasks/docker.rake
+++ b/lib/tasks/docker.rake
@@ -87,7 +87,7 @@ task 'docker:test' do
 
         unless ENV["SKIP_CORE"]
           puts "Listing prettier offenses in core:"
-          @good &&= run_or_fail('yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.{js,es6}"')
+          @good &&= run_or_fail('yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.js"')
         end
 
         unless ENV["SKIP_PLUGINS"]
diff --git a/plugins/discourse-details/assets/javascripts/initializers/apply-details.js b/plugins/discourse-details/assets/javascripts/initializers/apply-details.js
new file mode 100644
index 0000000..11b2117
--- /dev/null
+++ b/plugins/discourse-details/assets/javascripts/initializers/apply-details.js
@@ -0,0 +1,38 @@
+import I18n from "I18n";
+import { withPluginApi } from "discourse/lib/plugin-api";
+
+function initializeDetails(api) {
+  api.decorateCooked(($elem) => $("details", $elem), {
+    id: "discourse-details",
+  });
+
+  api.addToolbarPopupMenuOptionsCallback(() => {
+    return {
+      action: "insertDetails",
+      icon: "caret-right",
+      label: "details.title",
+    };
+  });
+
+  api.modifyClass("controller:composer", {
+    pluginId: "discourse-details",
+    actions: {
+      insertDetails() {
+        this.toolbarEvent.applySurround(
+          "\n" + `[details="${I18n.t("composer.details_title")}"]` + "\n",
+          "\n[/details]\n",
+          "details_text",
+          { multiline: false }
+        );
+      },
+    },
+  });
+}
+
+export default {
+  name: "apply-details",
+
+  initialize() {
+    withPluginApi("0.8.7", initializeDetails);
+  },
+};
diff --git a/plugins/discourse-details/assets/javascripts/initializers/apply-details.js.es6 b/plugins/discourse-details/assets/javascripts/initializers/apply-details.js.es6
deleted file mode 100644
index 11b2117..0000000
--- a/plugins/discourse-details/assets/javascripts/initializers/apply-details.js.es6
+++ /dev/null
@@ -1,38 +0,0 @@
-import I18n from "I18n";
-import { withPluginApi } from "discourse/lib/plugin-api";
-
-function initializeDetails(api) {
-  api.decorateCooked(($elem) => $("details", $elem), {
-    id: "discourse-details",
-  });
-
-  api.addToolbarPopupMenuOptionsCallback(() => {
-    return {
-      action: "insertDetails",
-      icon: "caret-right",
-      label: "details.title",
-    };
-  });
-
-  api.modifyClass("controller:composer", {
-    pluginId: "discourse-details",
-    actions: {
-      insertDetails() {
-        this.toolbarEvent.applySurround(
-          "\n" + `[details="${I18n.t("composer.details_title")}"]` + "\n",
-          "\n[/details]\n",
-          "details_text",
-          { multiline: false }
-        );
-      },
-    },
-  });
-}
-
-export default {
-  name: "apply-details",
-
-  initialize() {
-    withPluginApi("0.8.7", initializeDetails);
-  },
-};
diff --git a/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js b/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js
new file mode 100644
index 0000000..debaacc
--- /dev/null
+++ b/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js
@@ -0,0 +1,31 @@
+const rule = {
+  tag: "details",
+  before: function (state, tagInfo) {
+    const attrs = tagInfo.attrs;
+    state.push("bbcode_open", "details", 1);
+    state.push("bbcode_open", "summary", 1);
+
+    let token = state.push("text", "", 0);
+    token.content = attrs["_default"] || "";
+
+    state.push("bbcode_close", "summary", -1);
+  },
+
+  after: function (state) {
+    state.push("bbcode_close", "details", -1);
+  },
+};
+
+export function setup(helper) {
+  helper.allowList([
+    "summary",
+    "summary[title]",
+    "details",
+    "details[open]",
+    "details.elided",
+  ]);
+
+  helper.registerPlugin((md) => {
+    md.block.bbcode.ruler.push("details", rule);
+  });
+}
diff --git a/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6 b/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6
deleted file mode 100644
index debaacc..0000000
--- a/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6
+++ /dev/null
@@ -1,31 +0,0 @@
-const rule = {
-  tag: "details",
-  before: function (state, tagInfo) {
-    const attrs = tagInfo.attrs;
-    state.push("bbcode_open", "details", 1);
-    state.push("bbcode_open", "summary", 1);
-
-    let token = state.push("text", "", 0);
-    token.content = attrs["_default"] || "";
-
-    state.push("bbcode_close", "summary", -1);
-  },
-
-  after: function (state) {
-    state.push("bbcode_close", "details", -1);
-  },
-};
-
-export function setup(helper) {
-  helper.allowList([
-    "summary",
-    "summary[title]",
-    "details",
-    "details[open]",
-    "details.elided",
-  ]);
-
-  helper.registerPlugin((md) => {

[... diff too long, it was truncated ...]

GitHub sha: 4ad77f3382519c30d5c5cf7ef2bafbec6ece011d

This commit appears in #14912 which was approved by davidtaylorhq. It was merged by CvX.