Skip to content

chore/babel-esm #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/mdx-embed/.babelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
"plugins": [
"presets": [
[
"@babel/plugin-transform-modules-commonjs",
"@babel/preset-env",
{
"strictMode": false
"modules": false
}
],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
]
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread"]
}
14 changes: 12 additions & 2 deletions packages/mdx-embed/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],

extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
],
settings: {
Expand All @@ -17,12 +15,24 @@ module.exports = {
},
},
rules: {
'no-loop-func': 0,
'react/prop-types': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true,
},
},
],
},
};
2 changes: 0 additions & 2 deletions packages/mdx-embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"build:types": "tsc",
"build:js": "babel -d dist src --extensions=\".ts,.tsx\"",
"build": "npm run build:types && npm run build:js",
"develop": "babel -d dist src --extensions=\".ts,.tsx\" -w",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
Expand Down Expand Up @@ -44,7 +43,6 @@
"@babel/core": "^7.11.4",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.10.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { FunctionComponent, useRef, useEffect, useState, RefObject } from 'react';

interface GeneralObserverProps {
interface IGeneralObserverProps {
/** Fires when IntersectionObserver enters viewport */
onEnter?: (id?: string) => void;
/** The height of the placeholder div before the component renders in */
height?: number;
}

export const GeneralObserver: FunctionComponent<GeneralObserverProps> = ({ children, onEnter, height = 0 }) => {
export const GeneralObserver: FunctionComponent<IGeneralObserverProps> = ({ children, onEnter, height = 0 }) => {
const ref = useRef<HTMLElement>(null);
const [isChildVisible, setIsChildVisible] = useState(false);
useEffect(() => {
Expand Down
14 changes: 1 addition & 13 deletions packages/mdx-embed/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
{
"compilerOptions": {
// Target latest version of ECMAScript.
"target": "esnext",
// Search under node_modules for non-relative imports.
"moduleResolution": "node",
// Process & infer types from .js files.
"allowJs": true,
// Let TypeScript emit the d.ts files
"emitDeclarationOnly": true,
// Set declartion to true
"declaration": true,
// Determine where the d.ts files are put
"declarationDir": "./dist/types",
// Redirect to declarationDir
"declarationDir": "./dist/",
"outDir": "./dist/",
// Enable strictest settings like strictNullChecks & noImplicitAny.
"strict": true,
// Disallow features that require cross-file information for emit.
"isolatedModules": true,
// Import non-ES modules as default imports.
"esModuleInterop": true,
// Allow TypeScript to automatically compile tsx
"jsx": "react",
// Allow named exports rather than export * from
"allowSyntheticDefaultImports": true
},
"include": ["src"],
Expand Down