Add eslint-plugin-erb for .js.erb file linting

* Add eslint-plugin-erb to provide linting of our .js.erb files
* Lint osm.js.erb and API-ify OSM.params()
---------
Co-authored-by: Andy Allan <git@gravitystorm.co.uk>
This commit is contained in:
Marwin Hochfelsner 2025-01-26 22:47:11 +01:00 committed by Marwin Hochfelsner
parent 1dff2d5d5c
commit bc18e85d5c
5 changed files with 55 additions and 55 deletions

View file

@ -1,9 +1,11 @@
const globals = require("globals");
const js = require("@eslint/js");
const erb = require("eslint-plugin-erb");
const stylisticJs = require("@stylistic/eslint-plugin-js");
module.exports = [
js.configs.recommended,
erb.configs.recommended,
{
plugins: {
"@stylistic": stylisticJs
@ -24,6 +26,15 @@ module.exports = [
updateLinks: "readonly"
}
},
linterOptions: {
// The "unused disable directive" is set to "warn" by default.
// For the ERB plugin to work correctly, you must disable
// this directive to avoid issues described here
// https://github.com/eslint/eslint/discussions/18114
// If you're using the CLI, you might also use the following flag:
// --report-unused-disable-directives-severity=off
reportUnusedDisableDirectives: "off"
},
rules: {
"@stylistic/array-bracket-newline": ["error", "consistent"],
"@stylistic/array-bracket-spacing": "error",