-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(lint): Add tsdx lint command Use it to lint itself * feat(lint): process.exit(1) when errorCount > 0 * style(lint): Fix lint errors that failed the CI build * feat(lint): Play nicely with pretty-quick husky hook * feat(lint): Install eslint-prettier dependencies, remove tslint devDeps * feat(lint): Add jsx linting support for React by default * fix(lint): Fix local ignore-pattern * feat(lint): Use @typescript-eslint/no-unused-vars instead of typescript/no-unused-vars * Update lockfile * Merge branch 'master' into pr/skvale/99 * Add pre-commit lint hook * Specify no-unused-locals in tsconfig * feat(lint): Extend react-app from eslint-config-react-app * test(lint): Tests no longer failed from spacing violations * feat(lint): Could just extend react-app instead of overriding anything * feat(lint): Use prettier eslint for tsdx as an opt-in * feat(lint): Optionally use prettier with --prettier flag * feat(lint): Specify how to customize the lint rules in the README * feat(lint): Use prettier by default again * feat(lint): Use eslint@6 * chore(lockfile): Commit updated lockfile * feat(lint): Update to @typescript-eslint/{parser,eslint-plugin} v1.11.0 * chore(deps): Bump eslint and @typescript-eslint * feat(lint): Bump deps and simplify createEslintConfig * feat(lint): Simplify written eslintrc * chore(docs): Remove wrongfully merged README addition * chore(yarn.lock): Fix merge issue with the babel/core version * feat(lint): Bump eslint-config-react-app dep * feat(lint): Last small updates
- Loading branch information
1 parent
1a2e50c
commit e2f2983
Showing
18 changed files
with
1,882 additions
and
549 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
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,7 @@ | ||
module.exports = { | ||
extends: [ | ||
'react-app', | ||
'prettier/@typescript-eslint', | ||
'plugin:prettier/recommended', | ||
], | ||
}; |
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,41 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { CLIEngine } from 'eslint'; | ||
|
||
interface CreateEslintConfigArgs { | ||
rootDir: string; | ||
writeFile: boolean; | ||
} | ||
export function createEslintConfig({ | ||
rootDir, | ||
writeFile, | ||
}: CreateEslintConfigArgs): CLIEngine.Options['baseConfig'] { | ||
const config = { | ||
extends: [ | ||
'react-app', | ||
'prettier/@typescript-eslint', | ||
'plugin:prettier/recommended', | ||
], | ||
}; | ||
|
||
if (writeFile) { | ||
const file = path.join(rootDir, '.eslintrc.js'); | ||
if (fs.existsSync(file)) { | ||
console.error( | ||
'Error trying to save the Eslint configuration file:', | ||
`${file} already exists.` | ||
); | ||
} else { | ||
try { | ||
fs.writeFileSync( | ||
file, | ||
`module.exports = ${JSON.stringify(config, null, 2)}` | ||
); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
} | ||
|
||
return config; | ||
} |
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
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 @@ | ||
export const foo () => !!'bar'; |
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,5 @@ | ||
export const foo = ( ) => | ||
!! ('bar') | ||
; | ||
|
||
|
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 @@ | ||
export const foo = () => !!'bar'; |
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,5 @@ | ||
import React from 'react'; | ||
|
||
export const Foobar = (props: any) => { | ||
return <<div {...props}>foobar</div>; | ||
}; |
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,5 @@ | ||
import React from 'react'; | ||
|
||
export const Foobar = (props: any) => { | ||
return <div {...props}>foobar </div>; | ||
}; |
Oops, something went wrong.