From 06421d1a77bba29fcfe54e53f6a22e7fc8f2d45c 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 --- .github/workflows/ci.yml | 2 +- lib/config/recommended.js | 12 +- lib/index.js | 8 - lib/parsers/gjs-parser.js | 430 +++ 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 | 10 +- .../gjs-gts-processor-test.js | 113 +- yarn.lock | 3249 +++++++---------- 12 files changed, 1903 insertions(+), 2282 deletions(-) create mode 100644 lib/parsers/gjs-parser.js create mode 100644 lib/parsers/gts-parser.js delete mode 100644 lib/preprocessors/glimmer.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76ba9052c6..987166b3ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [ ubuntu, windows ] - node-version: [14.x, 16.x, 18.x] + node-version: [16.x, 18.x] steps: - uses: actions/checkout@v3 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/