Skip to content

Commit 07975fc

Browse files
committed
Configure eslint and prettier
1 parent 649de94 commit 07975fc

File tree

8 files changed

+490
-27
lines changed

8 files changed

+490
-27
lines changed

.eslintrc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
parser: "@typescript-eslint/parser",
3+
extends: [
4+
"plugin:react/recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"prettier/@typescript-eslint",
7+
"plugin:prettier/recommended"
8+
],
9+
parserOptions: {
10+
ecmaFeatures: {
11+
jsx: true
12+
},
13+
ecmaVersion: 2018,
14+
sourceType: "module"
15+
},
16+
rules: {
17+
"@typescript-eslint/explicit-function-return-type": "off"
18+
},
19+
settings: {
20+
react: {
21+
version: "detect"
22+
}
23+
}
24+
};

.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: true,
3+
trailingComma: "all",
4+
singleQuote: true,
5+
printWidth: 120,
6+
tabWidth: 2
7+
};

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"files.autoSave": "onFocusChange",
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": true
5+
},
6+
"eslint.validate": [
7+
"javascript",
8+
"javascriptreact",
9+
"typescript",
10+
"typescriptreact"
11+
]
12+
}

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
Flexible, typed and easy to use React component to provide CSV, TSV and other delimiter-separated values formats (DSV) import functionality.
33

44
## Tools
5-
- yarn
6-
- rollup
7-
- React
8-
- typescript
5+
- [yarn](https://yarnpkg.com/)
6+
- [rollup.js](https://rollupjs.org/)
7+
- [TypeScript](https://www.typescriptlang.org/)
8+
- [TypeScript ESLint](https://typescript-eslint.io/)
9+
- [React](https://reactjs.org/)
10+
- [Storybook](https://storybook.js.org/)
911

1012
## Resources
13+
- [Article: Using ESLint and Prettier in a TypeScript Project](https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project)
1114
- [Template: Rollup Starter Lib (TypeScript)](https://github.com/rollup/rollup-starter-lib/tree/typescript)
1215
- [Article: Creating a React Component library using Rollup, Typescript, Sass and Storybook](https://blog.harveydelaney.com/creating-your-own-react-component-library/) <br> Explains how to create a React component library using Rollup

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@
1717
"@types/node": "^13.11.1",
1818
"@types/react": "^16.9.34",
1919
"@types/react-dom": "^16.9.6",
20+
"@typescript-eslint/eslint-plugin": "^2.27.0",
21+
"@typescript-eslint/parser": "^2.27.0",
2022
"babel-loader": "^8.1.0",
2123
"babel-preset-react-app": "^9.1.2",
24+
"eslint": "^6.8.0",
25+
"eslint-config-prettier": "^6.10.1",
26+
"eslint-plugin-prettier": "^3.1.2",
27+
"eslint-plugin-react": "^7.19.0",
28+
"prettier": "^2.0.4",
2229
"rollup": "^2.6.0",
2330
"ts-node": "^8.8.2",
2431
"tslib": "^1.11.1",

src/DSVImport.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ export default { title: 'DSVImport' };
55

66
export const Primary = () => {
77
return <DSVImport />;
8-
}
8+
};

src/DSVImport.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
22

33
export const DSVImport: React.FC = () => {
4-
return <div>Hello</div>;
5-
}
4+
return <div>Hello</div>;
5+
};

0 commit comments

Comments
 (0)