Skip to content

Commit d68db2a

Browse files
committed
add initial support for typescript
1 parent 6e9d924 commit d68db2a

File tree

9 files changed

+1439
-1079
lines changed

9 files changed

+1439
-1079
lines changed

.editorconfig

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
# EditorConfig helps developers define and maintain consistent
2-
# coding styles between different editors and IDEs
3-
# editorconfig.org
1+
# http://editorconfig.org
42

53
root = true
64

75
[*]
8-
9-
# Change these settings to your own preference
10-
indent_style = space
6+
charset = utf-8
7+
indent_style = tab
118
indent_size = 2
12-
13-
# We recommend you to keep these unchanged
149
end_of_line = lf
15-
charset = utf-8
16-
trim_trailing_whitespace = true
1710
insert_final_newline = true
11+
trim_trailing_whitespace = true
1812

1913
[*.md]
14+
insert_final_newline = false
2015
trim_trailing_whitespace = false

.eslintrc.js

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,58 @@
11
module.exports = {
2-
parser: 'babel-eslint',
3-
extends: ['airbnb', 'plugin:jsx-a11y/recommended'],
4-
plugins: ['jest', 'react-hooks', 'jsx-a11y'],
5-
rules: {
6-
'max-len': 0,
7-
'react/forbid-prop-types': 0,
8-
'import/no-extraneous-dependencies': 0,
9-
'no-confusing-arrow': ['error', { allowParens: true }],
10-
'arrow-parens': ['error', 'as-needed'],
11-
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
12-
'import/prefer-default-export': 0,
13-
'object-curly-newline': ['error', { consistent: true }],
14-
'implicit-arrow-linebreak': 0,
15-
'operator-linebreak': 0,
16-
'linebreak-style': 0,
17-
'arrow-body-style': 0,
18-
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
19-
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
20-
'react/jsx-props-no-spreading': 0,
21-
},
22-
env: {
23-
'jest/globals': true,
24-
browser: true,
25-
},
26-
settings: {
27-
'import/resolver': {
28-
'babel-module': {},
29-
},
30-
},
31-
overrides: [
32-
{
33-
files: ['**/*.ts', '**/*.tsx'],
34-
env: { browser: true, es6: true, node: true },
35-
extends: [
36-
'eslint:recommended',
37-
'plugin:react/recommended',
38-
'plugin:@typescript-eslint/eslint-recommended',
39-
'plugin:@typescript-eslint/recommended',
40-
],
41-
globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
42-
parser: '@typescript-eslint/parser',
43-
parserOptions: {
44-
ecmaFeatures: { jsx: true },
45-
ecmaVersion: 2018,
46-
sourceType: 'module',
47-
},
48-
plugins: ['react', '@typescript-eslint'],
49-
rules: {
50-
indent: ['error', 2, { SwitchCase: 1 }],
51-
'linebreak-style': ['error', 'unix'],
52-
quotes: ['error', 'single'],
53-
'comma-dangle': ['error', 'always-multiline'],
54-
'@typescript-eslint/no-explicit-any': 0,
55-
'@typescript-eslint/interface-name-prefix': 0,
56-
},
57-
settings: { react: { version: 'detect' } },
58-
},
59-
],
2+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
3+
extends: [
4+
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
5+
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
6+
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
7+
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
8+
'plugin:react-hooks/recommended',
9+
],
10+
parserOptions: {
11+
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
12+
sourceType: 'module', // Allows for the use of imports
13+
ecmaFeatures: {
14+
jsx: true, // Allows for the parsing of JSX
15+
},
16+
},
17+
settings: {
18+
react: {
19+
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
20+
},
21+
},
22+
rules: {
23+
'react/prop-types': 'off',
24+
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
25+
// '@typescript-eslint/ban-ts-comment': [{ 'ts-ignore': 'allow-with-description', minimumDescriptionLength: 10 }],
26+
'prettier/prettier': [
27+
'error',
28+
{
29+
singleQuote: true,
30+
},
31+
],
32+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
33+
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
34+
},
35+
overrides: [
36+
{
37+
files: ['**/*.js', '**/*.jsx'],
38+
plugins: ['jest', 'react-hooks', 'jsx-a11y'],
39+
rules: {
40+
'max-len': 0,
41+
'react/forbid-prop-types': 0,
42+
'import/no-extraneous-dependencies': 0,
43+
'no-confusing-arrow': ['error', { allowParens: true }],
44+
'arrow-parens': ['error', 'as-needed'],
45+
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
46+
'import/prefer-default-export': 0,
47+
'object-curly-newline': ['error', { consistent: true }],
48+
'implicit-arrow-linebreak': 0,
49+
'operator-linebreak': 0,
50+
'linebreak-style': 0,
51+
'arrow-body-style': 0,
52+
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
53+
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
54+
'react/jsx-props-no-spreading': 0,
55+
},
56+
},
57+
],
6058
};

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=lf
3+
4+
# Ignore any binary files
5+
* binary

.prettierrc.js

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

.stylelintrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"rules": {
88
"declaration-colon-newline-after": null,
99
"value-list-max-empty-lines": null,
10-
"value-keyword-case": null
11-
},
12-
"syntax": "scss"
10+
"value-keyword-case": null,
11+
"indentation": "tab"
12+
}
1313
}

.vscode/settings.json

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
1-
{
2-
"files.associations": {
3-
".editorconfig": "javascriptreact"
4-
},
5-
"editor.formatOnType": true,
6-
// "eslint.options": {"configFile": "./package.json"},
7-
"editor.tabSize": 2,
8-
"editor.trimAutoWhitespace": true,
9-
"files.trimTrailingWhitespace": true,
10-
"eslint.nodePath": "./src",
11-
"editor.formatOnSave": false,
12-
"window.zoomLevel": 0,
13-
"workbench.iconTheme": "material-icon-theme",
14-
// "terminal.integrated.fontFamily": "Knack Nerd Font",
15-
"terminal.integrated.fontSize": 13,
16-
"terminal.integrated.shellArgs.osx": [
17-
"-l"
18-
],
19-
"terminal.integrated.shell.osx": "zsh",
20-
"terminal.integrated.scrollback": 5000,
21-
"editor.fontSize": 13,
22-
// "editor.minimap.enabled": true,
23-
"extensions.autoUpdate": true
24-
}
1+
{
2+
"files.associations": {
3+
".editorconfig": "javascriptreact"
4+
},
5+
"editor.formatOnType": true,
6+
// "eslint.options": {"configFile": "./package.json"},
7+
"editor.tabSize": 2,
8+
"editor.trimAutoWhitespace": true,
9+
"files.trimTrailingWhitespace": true,
10+
"eslint.nodePath": "./src",
11+
"editor.formatOnSave": false,
12+
"window.zoomLevel": 0,
13+
"workbench.iconTheme": "material-icon-theme",
14+
// "terminal.integrated.fontFamily": "Knack Nerd Font",
15+
"terminal.integrated.fontSize": 13,
16+
"terminal.integrated.shellArgs.osx": [
17+
"-l"
18+
],
19+
"terminal.integrated.shell.osx": "zsh",
20+
"terminal.integrated.scrollback": 5000,
21+
"editor.fontSize": 13,
22+
// "editor.minimap.enabled": true,
23+
"extensions.autoUpdate": true,
24+
"editor.codeActionsOnSave": {
25+
"source.fixAll.eslint": true
26+
},
27+
"[javascript]": {
28+
"editor.formatOnSave": true,
29+
"editor.defaultFormatter": "esbenp.prettier-vscode"
30+
},
31+
"[typescript]": {
32+
"editor.defaultFormatter": "esbenp.prettier-vscode"
33+
},
34+
"[typescriptreact]": {
35+
"editor.defaultFormatter": "esbenp.prettier-vscode"
36+
},
37+
"[jsonc]": {
38+
"editor.defaultFormatter": "vscode.json-language-features"
39+
},
40+
"prettier.useTabs": true,
41+
}

package.json

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-data-table-component",
3-
"version": "6.11.6",
3+
"version": "7.0.0",
44
"description": "A declarative react based data table",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.es.js",
@@ -58,15 +58,20 @@
5858
"@babel/preset-react": "^7.10.4",
5959
"@material-ui/core": "^4.9.12",
6060
"@material-ui/icons": "^4.9.1",
61-
"@storybook/addon-a11y": "^6.0.27",
62-
"@storybook/addon-actions": "^6.0.27",
61+
"@storybook/addon-a11y": "^6.0.28",
62+
"@storybook/addon-actions": "^6.0.28",
6363
"@storybook/addon-console": "^1.2.2",
64-
"@storybook/addon-links": "^6.0.27",
65-
"@storybook/addon-storysource": "^6.0.27",
66-
"@storybook/react": "^6.0.27",
67-
"@testing-library/react": "^10.0.4",
68-
"@typescript-eslint/eslint-plugin": "^4.7.0",
69-
"@typescript-eslint/parser": "^4.7.0",
64+
"@storybook/addon-links": "^6.0.28",
65+
"@storybook/addon-storysource": "^6.0.28",
66+
"@storybook/react": "^6.0.28",
67+
"@testing-library/react": "^11.1.2",
68+
"@types/jest": "^26.0.15",
69+
"@types/node": "^14.14.8",
70+
"@types/react": "^16.9.56",
71+
"@types/react-dom": "^16.9.9",
72+
"@types/styled-components": "^5.1.4",
73+
"@typescript-eslint/eslint-plugin": "^4.8.1",
74+
"@typescript-eslint/parser": "^4.8.1",
7075
"axios": "^0.19.2",
7176
"babel-eslint": "^10.1.0",
7277
"babel-jest": "^25.5.1",
@@ -77,36 +82,39 @@
7782
"cross-env": "^7.0.2",
7883
"eslint": "^7.13.0",
7984
"eslint-config-airbnb": "^18.2.1",
85+
"eslint-config-prettier": "^6.15.0",
8086
"eslint-config-react-app": "^6.0.0",
8187
"eslint-import-resolver-babel-module": "^5.2.0",
8288
"eslint-plugin-import": "^2.22.1",
83-
"eslint-plugin-jest": "^24.1.0",
89+
"eslint-plugin-jest": "^24.1.3",
8490
"eslint-plugin-jsx-a11y": "^6.4.1",
91+
"eslint-plugin-prettier": "^3.1.4",
8592
"eslint-plugin-react": "^7.21.5",
8693
"eslint-plugin-react-hooks": "^4.2.0",
8794
"faker": "^4.1.0",
88-
"jest": "^25.5.3",
89-
"jest-styled-components": "^7.0.2",
95+
"jest": "^26.6.3",
96+
"jest-styled-components": "^7.0.3",
9097
"lodash-es": "^4.17.15",
9198
"memoize-one": "^5.1.1",
9299
"moment": "^2.24.0",
93-
"react": "^16.13.1",
94-
"react-dom": "^16.13.1",
100+
"react": "^17.0.1",
101+
"react-dom": "^17.0.1",
95102
"rimraf": "^3.0.2",
96-
"rollup": "^2.7.6",
103+
"rollup": "^2.33.3",
97104
"rollup-plugin-babel": "^4.4.0",
98105
"rollup-plugin-commonjs": "^10.1.0",
99106
"rollup-plugin-copy": "^3.3.0",
100107
"rollup-plugin-node-resolve": "^5.2.0",
101-
"rollup-plugin-terser": "^5.3.0",
108+
"rollup-plugin-terser": "^7.0.2",
102109
"rollup-plugin-uglify": "^6.0.4",
103-
"rollup-plugin-visualizer": "^4.0.4",
110+
"rollup-plugin-visualizer": "^4.2.0",
104111
"styled-components": "^5.0.1",
105-
"stylelint": "^13.3.3",
112+
"stylelint": "^13.8.0",
106113
"stylelint-config-standard": "^20.0.0",
107114
"stylelint-config-styled-components": "^0.1.1",
108115
"stylelint-processor-styled-components": "^1.10.0",
109-
"typescript": "^3.9.7"
116+
"ts-jest": "^26.4.4",
117+
"typescript": "^4.0.5"
110118
},
111119
"dependencies": {
112120
"deepmerge": "^4.2.2",

tsconfig.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"skipLibCheck": true,
5+
"esModuleInterop": true,
6+
"strict": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"module": "esnext",
9+
"moduleResolution": "node",
10+
"resolveJsonModule": true,
11+
"isolatedModules": true,
12+
"jsx": "react",
13+
"sourceMap": true,
14+
"target": "es5",
15+
"experimentalDecorators": true,
16+
"declaration": false,
17+
"removeComments": true,
18+
"noImplicitReturns": true,
19+
"noUnusedLocals": true,
20+
"outDir": "build",
21+
"lib": [
22+
"es6",
23+
"es7",
24+
"dom"
25+
],
26+
"baseUrl": "src",
27+
"allowSyntheticDefaultImports": true,
28+
},
29+
}

0 commit comments

Comments
 (0)