Skip to content
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

chore: fix eslint and ts errors in dev and introduce tsconfig.prod.ts file #74

Closed
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
47 changes: 28 additions & 19 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"react/no-render-return-value": 0,
/* JSX rules */
"react/jsx-key": "error",
/* Since we are using React 17+ we no longer need these */
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
/* eslint basic rules */
"padding-line-between-statements": [
"error",
Expand All @@ -56,27 +59,33 @@
// "no-unused-expressions": "warn",
"no-unused-vars": "off",
"no-debugger": "warn",
"no-console": "warn",

"no-console": "warn"
},
"overrides": [
/* Typescript rules */
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "all",
"argsIgnorePattern": "^__",
"varsIgnorePattern": "^__|React"
{
"files": ["**/*.ts?(x)"],
"rules": {
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "all",
"argsIgnorePattern": "^__",
"varsIgnorePattern": "^__|React"
}
],
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/prefer-interface": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/ban-ts-comment": "warn"
}
],
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/prefer-interface": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/ban-ts-comment": "warn"
},
}
],
"settings": {
"react": {
"pragma": "React",
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"exports": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"default": "./dist/cjs/index.js"
},
"files": [
"dist"
],
Expand Down Expand Up @@ -83,8 +89,8 @@
"documentation": "cd documentation && yarn start",
"documentation:build": "cd documentation && yarn install && yarn build",
"build": "rimraf ./dist/types && npm run build:esm && npm run build:cjs",
"build:esm": "rimraf ./dist/esm && tsc --module esnext --outDir dist/esm && copyfiles -f ./src/assets/* ./dist/esm/assets/",
"build:cjs": "rimraf ./dist/cjs && tsc --module commonjs --outDir dist/cjs && copyfiles -f ./src/assets/* ./dist/cjs/assets/",
"build:esm": "rimraf ./dist/esm && tsc -p tsconfig.prod.json --module esnext --outDir dist/esm && copyfiles -f ./src/assets/* ./dist/esm/assets/",
"build:cjs": "rimraf ./dist/cjs && tsc -p tsconfig.prod.json --module commonjs --outDir dist/cjs && copyfiles -f ./src/assets/* ./dist/cjs/assets/",
"yalc:push": "yalc publish --push",
"watch": "tsc-watch --noClear -p ./tsconfig.json --onSuccess \"yarn yalc:push\"",
"lint": "eslint './src/**/*.{ts,tsx}'",
Expand Down
26 changes: 5 additions & 21 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
"outDir": "dist",
"module": "esnext",
"target": "es5",
"lib": [
"es5",
"es6",
"es7",
"es2017",
"dom"
],
"lib": ["es5", "es6", "es7", "es2017", "dom"],
"sourceMap": true,
"skipLibCheck": true,
"allowJs": true,
"jsx": "react-jsx",
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true,
"rootDir": "./src",
"rootDir": "./",
mkarajohn marked this conversation as resolved.
Show resolved Hide resolved
"baseUrl": "./src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
Expand All @@ -29,20 +23,12 @@
"declaration": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"types": [
"node",
"jest",
"@testing-library/jest-dom"
],
"types": ["node", "jest", "@testing-library/jest-dom"],
"jsxImportSource": "react",
"declarationDir": "./dist/types",
"declarationDir": "./dist/types"
},
"include": [
"./src/*",
"./src/**/*"
],
"include": ["src", "setup-jest.ts"],
"exclude": [
"**/node_modules/**/",
"node_modules",
"build",
"dist",
Expand All @@ -54,8 +40,6 @@
"**/__snapshots__",
"**/*.stories.tsx",
"**/*.stories.mdx",
"**/*.test.ts",
"**/*.test.tsx",
"__mocks__",
"./jest.config.js"
]
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["**/*.test.ts", "**/*.test.tsx"]
}
Loading