Skip to content

Commit c10e09b

Browse files
authored
chore: add config comment for mitosis.configs (#3981)
chore: rename some js files to match with esm or commonjs chore: improve eslint for components chore: make CUSTOM_ELEMENTS_SCHEMA optional for angular showcase fix: issues with _templates
1 parent 84927f7 commit c10e09b

File tree

56 files changed

+144
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+144
-71
lines changed

.eslintrc.js renamed to .eslintrc.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* We use this for IntelliJ IDEs to fetch xo config */
2-
export default {
2+
const config = {
33
eslintConfig: {
44
parser: 'babel-eslint',
55
env: {
@@ -9,3 +9,5 @@ export default {
99
extends: ['./node_modules/xo/config/plugins.js']
1010
}
1111
};
12+
13+
export default config;

packages/components/.eslintrc.cjs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* eslint-disable no-undef */
2+
3+
/** @type {import('eslint').Linter.Config} */
4+
module.exports = {
5+
overrides: [
6+
{
7+
files: ['**/*.lite.tsx'],
8+
rules: {
9+
/**
10+
* We need "any" for events because of different behavior between frameworks
11+
*/
12+
'@typescript-eslint/no-explicit-any': 'off'
13+
}
14+
},
15+
{
16+
files: ['**/shared/model.ts'],
17+
rules: {
18+
/**
19+
* We have some generics that are used later after generating the code for frameworks
20+
*/
21+
'@typescript-eslint/no-unused-vars': 'off'
22+
}
23+
},
24+
{
25+
files: ['**/configs/**/*.cjs'],
26+
rules: {
27+
/**
28+
* Mitosis requires CommonJS modules
29+
*/
30+
'@typescript-eslint/no-require-imports': 'off',
31+
'no-undef': 'off'
32+
}
33+
}
34+
],
35+
env: {
36+
browser: true,
37+
es2021: true
38+
},
39+
extends: [
40+
'eslint:recommended',
41+
'plugin:@typescript-eslint/recommended',
42+
'plugin:@builder.io/mitosis/recommended'
43+
],
44+
parser: '@typescript-eslint/parser',
45+
parserOptions: {
46+
ecmaFeatures: {
47+
jsx: true
48+
},
49+
ecmaVersion: 'latest',
50+
sourceType: 'module'
51+
},
52+
plugins: ['@typescript-eslint', '@builder.io/mitosis']
53+
};

packages/components/.eslintrc.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/components/_templates/mitosis/new/component/tsx.ejs.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function DB<%= h.changeCase.pascal(name) %>(props: DB<%= h.change
5757

5858
return (
5959
<div
60-
ref={ref}
60+
ref={_ref}
6161
id={props.id}
6262
class={cls('db-<%= name %>', props.className)}
6363
<% if(formValue!=="no"){ -%>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
inject: true
33
to: "<%= showcases ? `../../showcases/patternhub/components/component-parser/index.tsx` : null %>"
4-
before: } from '../../../../output/react/src/index';
4+
prepend: true
55
---
6-
,DB<%= h.changeCase.pascal(name) %>
6+
import { DB<%= h.changeCase.pascal(name) %> } from '../../../../output/react/src/index';

packages/components/configs/angular/mitosis.config.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const angular = require('./index.cjs');
2-
2+
/**
3+
* @type {import('@builder.io/mitosis').MitosisConfig}
4+
*/
35
module.exports = {
46
files: 'src/**',
57
targets: ['angular'],

packages/components/configs/mitosis.config.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const react = require('./react/index.cjs');
33
const vue = require('./vue/index.cjs');
44
const stencil = require('./stencil/index.cjs');
55

6+
/**
7+
* @type {import('@builder.io/mitosis').MitosisConfig}
8+
*/
69
module.exports = {
710
files: 'src/**',
811
targets: ['angular', 'vue', 'react', 'stencil'],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @type {import('@builder.io/mitosis').ToReactOptions}
3+
*/
14
module.exports = {
25
typescript: true
36
};

0 commit comments

Comments
 (0)