Skip to content

Commit

Permalink
Merge pull request #1942 from patricklx/use-custom-parser
Browse files Browse the repository at this point in the history
use custom parser for gts/gjs
  • Loading branch information
NullVoxPopuli committed Nov 1, 2023
2 parents 89144c6 + 9dbfa05 commit 068609d
Show file tree
Hide file tree
Showing 15 changed files with 956 additions and 1,104 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ module.exports = {
};
```

## gts/gjs

lint files having `First-Class Component Templates`

learn more [here](https://github.com/ember-template-imports/ember-template-imports)

```js
// .eslintrc.js
module.exports = {
overrides: [
{
files: ['**/*.gts', '**/*.gjs'],
parser: 'eslint-plugin-ember/gjs-gts-parser',
}
],
};
```

## 🧰 Configurations

<!-- begin auto-generated configs list -->
Expand Down
9 changes: 3 additions & 6 deletions lib/config/recommended.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const rules = require('../recommended-rules');
const util = require('ember-template-imports/src/util');

module.exports = {
root: true,
Expand Down Expand Up @@ -29,11 +28,9 @@ module.exports = {
* on -- and isn't relevant to user-land code.
*/
{
files: ['**/*.gjs', '**/*.gts'],
processor: 'ember/<template>',
globals: {
[util.TEMPLATE_TAG_PLACEHOLDER]: 'readonly',
},
files: ['**/*.gts', '**/*.gjs'],
parser: 'eslint-plugin-ember/gjs-gts-parser',
processor: 'ember/<noop>',
},
],
};
7 changes: 2 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

const requireIndex = require('requireindex');

const gjs = require('./preprocessors/glimmer');
const noop = require('./preprocessors/noop');

module.exports = {
rules: requireIndex(`${__dirname}/rules`),
Expand All @@ -12,8 +11,6 @@ module.exports = {
},
processors: {
// https://eslint.org/docs/developer-guide/working-with-plugins#file-extension-named-processor
'.gjs': gjs,
'.gts': gjs,
'<template>': gjs,
'<noop>': noop,
},
};
Loading

0 comments on commit 068609d

Please sign in to comment.