Skip to content

Commit

Permalink
feat(typescript): add typesript support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: .eslintrc -> .eslintrc.js, entryFilenameJs & entryFilenameTs options added in
wm-config.js
  • Loading branch information
nikhilnayyar002 committed Oct 2, 2021
2 parents c902f9f + 51a8d07 commit 2d5e753
Show file tree
Hide file tree
Showing 9 changed files with 344 additions and 63 deletions.
39 changes: 0 additions & 39 deletions .eslintrc

This file was deleted.

61 changes: 61 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const typescript = require('./wm-config').typescript

module.exports = {
"root": true,
...(typescript ? { "parser": "@typescript-eslint/parser" } : {}),
"plugins": [
typescript && "@typescript-eslint"
].filter(Boolean),
"env": {
"browser": true,
"es2021": true,
"node": true,
"worker": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"extends": [
"eslint:recommended",
typescript && "plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
].filter(Boolean),
"parserOptions": {
"sourceType": "module",
"requireConfigFile": false
},
"rules": {
...(typescript ? {
"@typescript-eslint/no-use-before-define": [
"error",
{
"functions": false
}
]
} : {
"no-use-before-define": [
"error",
{
"functions": false
}
],
"no-unused-vars": "warn",
}),
"react/react-in-jsx-scope": "off"
},
"globals": {
"process": "readonly"
},
"settings": {
"react": {
"version": "detect"
}
},
"ignorePatterns": [
"/**/*.*",
"!src/**/*.*"
]
}
20 changes: 20 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** images */

declare module "*.avif"
declare module "*.gif"
declare module "*.apng"
declare module '*.png'
declare module "*.jpg"
declare module "*.jpeg"
declare module "*.jfif"
declare module "*.pjpeg"
declare module "*.pjp"
declare module "*.svg"
declare module "*.webp"

/** svg as react component */
declare module "*.svg?react"

/** other */

declare module "*.txt"
201 changes: 201 additions & 0 deletions package-lock.json

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

Loading

0 comments on commit 2d5e753

Please sign in to comment.