Skip to content

Commit

Permalink
Add preact fragment syntax support (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebeby authored Aug 12, 2020
1 parent e7ce78b commit 7567514
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-rocks-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-caleb': minor
---

Add support for preact fragments syntax
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports.environments = hoist('jest', jest.environments)
module.exports.configs = {
recommended: {
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: { jsx: true },
},
Expand Down Expand Up @@ -259,7 +259,14 @@ module.exports.configs = {
},
preact: {
plugins: ['caleb'],
settings: { react: { pragma: 'h', version: '16' } },
settings: {
react: {
version: '16.13',
pragma: 'h',
// Problem: the react plugin interprets this as <h.Fragment> so it does not notice <Fragment>
fragment: 'Fragment',
},
},
extends: 'plugin:caleb/react',
rules: prefix({
'react/no-unknown-property': 'off', // preact uses class, for, and dashed svg attributes
Expand Down

0 comments on commit 7567514

Please sign in to comment.