I’m seeing a significant difference in default linting configuration, and the way it supposed to work.
The default configuration installs the eslint-config-discourse package as a dev devendency:
https://www.npmjs.com/package/eslint-config-discourse
However, when I look for the source code at https://github.com/discourse/eslint-config-discourse the repository redirected to @discourse/lint-configs; which is also a package under eslint-config-discourse monorepo. With the included tests eslint-config-discourse supposed to be a wrapper I think, but it is not working as it supposed to be, at least not in my experience:
Default Linting Config
- Create a new theme using
discourse_theme newcommand. - Review generated linting configuration:
a..eslintrc
b.{ "extends": "eslint-config-discourse", "globals": { "settings": "readonly", "themePrefix": "readonly" } }.template-lintrc.js:
c.module.exports = { plugins: ["ember-template-lint-plugin-discourse"], extends: "discourse:recommended", };package.json{ "license": "MIT", "devDependencies": { "eslint-config-discourse": "latest" } } - Run Prettier on the package, and it will complain about the
*.gjsfiles:yarn prettier --check --write "{common,javascripts,desktop,mobile,test,scss}/**/*.{js,gjs,es6,scss}"Error: No parser could be inferred for file ... .gjs
Configure @discourse/lint-configs directly
https://www.npmjs.com/package/@discourse/lint-configs
- Run
yarn remove -D eslint-config-discourseto uninstall the package. - Run
yarn add -D @discourse/lint-configsto install as dev dependency - Follow the instructions to create linting configuration files:
a. Replace.eslintrcfile with.eslintrc.cjs
b. Addmodule.exports = require("@discourse/lint-configs/eslint-theme");.prettierrc.cjsfile:
c. Replacemodule.exports = require("@discourse/lint-configs/prettier");.template-lintrc.jsfile with.template-lintrc.cjs:module.exports = require("@discourse/lint-configs/template-lint"); - Try running Prettier again, and observe that it works without errors:
$ yarn prettier --check --write "{common,javascripts,desktop,mobile,test,scss}/**/*.{js,gjs,es6,scss}" Checking formatting... All matched files use Prettier code style! ✨ Done in 0.46s.
So, should I presume discourse_theme CLI is outdated, and moving forward I should use the @discourse/lint-configs option in my projects?

