-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: eslint + airbnb compat with TypeScript
- Loading branch information
Showing
6 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ | |
"env": { | ||
"mocha": true, | ||
"cypress/globals": true | ||
}, | ||
"rules": { | ||
"strict": "off" | ||
} | ||
} | ||
<%_ } _%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = function convertImports (file) { | ||
return file | ||
.replace(/import (.*from )?('([^']+)'|"([^"]+)")/g, ($1, $2, $3, $4) => { | ||
const isRelative = $4.charAt(0) === '.' | ||
const isExtensionless = !/\.\w+$/.test($4) | ||
const isJS = /\.js$/.test($4) | ||
const replaced = isRelative | ||
? isExtensionless | ||
? $3.replace($4, `${$4}.ts`) | ||
: isJS | ||
? $3.replace(/\.js('|")$/, '.ts$1') | ||
: $3 | ||
: $3 | ||
return `import ${$2 || ''}${replaced}` | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@yyx990803 Is there something I can read to understand why this is needed? :) What's the reason for wanting extraneous dependencies in tests? Is it to allow importing typescript declarations, or something entirely different? :)