From 8682c875d92ec2487c05c64fd72e441cb73719f4 Mon Sep 17 00:00:00 2001 From: patrick Date: Thu, 27 Jul 2023 13:21:47 +0200 Subject: [PATCH] use custom parser for gts/gjs bonus: * enables type aware lints * prettier eslint plugin (with template tag prettier plugin) will just work for gts/gjs * can detect unused block params in templates * can detect undef vars in PathExpression * can add eslint directive comments in mustache or html disadvantage: * prettier will not work without template tag prettier plugin for gts/gjs files --- lib/config/recommended.js | 12 +- lib/index.js | 8 - lib/parsers/gjs-parser.js | 442 +++ lib/parsers/gts-parser.js | 7 + lib/preprocessors/glimmer.js | 313 -- .../no-empty-glimmer-component-classes.js | 5 +- lib/rules/no-unused-services.js | 26 +- lib/utils/document.js | 10 +- package.json | 13 +- .../gjs-gts-processor-test.js | 173 +- tests/lib/rules-preprocessor/my-component.gts | 1 + .../rules-preprocessor/tsconfig.eslint.json | 10 + yarn.lock | 3312 +++++++---------- 13 files changed, 2019 insertions(+), 2313 deletions(-) create mode 100644 lib/parsers/gjs-parser.js create mode 100644 lib/parsers/gts-parser.js delete mode 100644 lib/preprocessors/glimmer.js create mode 100644 tests/lib/rules-preprocessor/my-component.gts create mode 100644 tests/lib/rules-preprocessor/tsconfig.eslint.json diff --git a/lib/config/recommended.js b/lib/config/recommended.js index e45976c2ef..06a43f39f7 100644 --- a/lib/config/recommended.js +++ b/lib/config/recommended.js @@ -1,5 +1,4 @@ const rules = require('../recommended-rules'); -const util = require('ember-template-imports/src/util'); module.exports = { root: true, @@ -29,11 +28,12 @@ module.exports = { * on -- and isn't relevant to user-land code. */ { - files: ['**/*.gjs', '**/*.gts'], - processor: 'ember/