Skip to content

Commit

Permalink
add initial support for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
jbetancur committed Nov 18, 2020
1 parent 6e9d924 commit d68db2a
Show file tree
Hide file tree
Showing 9 changed files with 1,439 additions and 1,079 deletions.
15 changes: 5 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
# http://editorconfig.org

root = true

[*]

# Change these settings to your own preference
indent_style = space
charset = utf-8
indent_style = tab
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
114 changes: 56 additions & 58 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,58 @@
module.exports = {
parser: 'babel-eslint',
extends: ['airbnb', 'plugin:jsx-a11y/recommended'],
plugins: ['jest', 'react-hooks', 'jsx-a11y'],
rules: {
'max-len': 0,
'react/forbid-prop-types': 0,
'import/no-extraneous-dependencies': 0,
'no-confusing-arrow': ['error', { allowParens: true }],
'arrow-parens': ['error', 'as-needed'],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'import/prefer-default-export': 0,
'object-curly-newline': ['error', { consistent: true }],
'implicit-arrow-linebreak': 0,
'operator-linebreak': 0,
'linebreak-style': 0,
'arrow-body-style': 0,
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
'react/jsx-props-no-spreading': 0,
},
env: {
'jest/globals': true,
browser: true,
},
settings: {
'import/resolver': {
'babel-module': {},
},
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
env: { browser: true, es6: true, node: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react', '@typescript-eslint'],
rules: {
indent: ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
'comma-dangle': ['error', 'always-multiline'],
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/interface-name-prefix': 0,
},
settings: { react: { version: 'detect' } },
},
],
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'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.
'plugin:react-hooks/recommended',
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
rules: {
'react/prop-types': 'off',
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
// '@typescript-eslint/ban-ts-comment': [{ 'ts-ignore': 'allow-with-description', minimumDescriptionLength: 10 }],
'prettier/prettier': [
'error',
{
singleQuote: true,
},
],
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
},
overrides: [
{
files: ['**/*.js', '**/*.jsx'],
plugins: ['jest', 'react-hooks', 'jsx-a11y'],
rules: {
'max-len': 0,
'react/forbid-prop-types': 0,
'import/no-extraneous-dependencies': 0,
'no-confusing-arrow': ['error', { allowParens: true }],
'arrow-parens': ['error', 'as-needed'],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'import/prefer-default-export': 0,
'object-curly-newline': ['error', { consistent: true }],
'implicit-arrow-linebreak': 0,
'operator-linebreak': 0,
'linebreak-style': 0,
'arrow-body-style': 0,
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
'react/jsx-props-no-spreading': 0,
},
},
],
};
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=lf

# Ignore any binary files
* binary
9 changes: 9 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
semi: true,
jsxBracketSameLine: false,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 2,
arrowParens: 'avoid',
};
6 changes: 3 additions & 3 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"rules": {
"declaration-colon-newline-after": null,
"value-list-max-empty-lines": null,
"value-keyword-case": null
},
"syntax": "scss"
"value-keyword-case": null,
"indentation": "tab"
}
}
65 changes: 41 additions & 24 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
{
"files.associations": {
".editorconfig": "javascriptreact"
},
"editor.formatOnType": true,
// "eslint.options": {"configFile": "./package.json"},
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true,
"eslint.nodePath": "./src",
"editor.formatOnSave": false,
"window.zoomLevel": 0,
"workbench.iconTheme": "material-icon-theme",
// "terminal.integrated.fontFamily": "Knack Nerd Font",
"terminal.integrated.fontSize": 13,
"terminal.integrated.shellArgs.osx": [
"-l"
],
"terminal.integrated.shell.osx": "zsh",
"terminal.integrated.scrollback": 5000,
"editor.fontSize": 13,
// "editor.minimap.enabled": true,
"extensions.autoUpdate": true
}
{
"files.associations": {
".editorconfig": "javascriptreact"
},
"editor.formatOnType": true,
// "eslint.options": {"configFile": "./package.json"},
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true,
"eslint.nodePath": "./src",
"editor.formatOnSave": false,
"window.zoomLevel": 0,
"workbench.iconTheme": "material-icon-theme",
// "terminal.integrated.fontFamily": "Knack Nerd Font",
"terminal.integrated.fontSize": 13,
"terminal.integrated.shellArgs.osx": [
"-l"
],
"terminal.integrated.shell.osx": "zsh",
"terminal.integrated.scrollback": 5000,
"editor.fontSize": 13,
// "editor.minimap.enabled": true,
"extensions.autoUpdate": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"prettier.useTabs": true,
}
46 changes: 27 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-data-table-component",
"version": "6.11.6",
"version": "7.0.0",
"description": "A declarative react based data table",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down Expand Up @@ -58,15 +58,20 @@
"@babel/preset-react": "^7.10.4",
"@material-ui/core": "^4.9.12",
"@material-ui/icons": "^4.9.1",
"@storybook/addon-a11y": "^6.0.27",
"@storybook/addon-actions": "^6.0.27",
"@storybook/addon-a11y": "^6.0.28",
"@storybook/addon-actions": "^6.0.28",
"@storybook/addon-console": "^1.2.2",
"@storybook/addon-links": "^6.0.27",
"@storybook/addon-storysource": "^6.0.27",
"@storybook/react": "^6.0.27",
"@testing-library/react": "^10.0.4",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"@storybook/addon-links": "^6.0.28",
"@storybook/addon-storysource": "^6.0.28",
"@storybook/react": "^6.0.28",
"@testing-library/react": "^11.1.2",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.8",
"@types/react": "^16.9.56",
"@types/react-dom": "^16.9.9",
"@types/styled-components": "^5.1.4",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"axios": "^0.19.2",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.5.1",
Expand All @@ -77,36 +82,39 @@
"cross-env": "^7.0.2",
"eslint": "^7.13.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^6.15.0",
"eslint-config-react-app": "^6.0.0",
"eslint-import-resolver-babel-module": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"faker": "^4.1.0",
"jest": "^25.5.3",
"jest-styled-components": "^7.0.2",
"jest": "^26.6.3",
"jest-styled-components": "^7.0.3",
"lodash-es": "^4.17.15",
"memoize-one": "^5.1.1",
"moment": "^2.24.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"rimraf": "^3.0.2",
"rollup": "^2.7.6",
"rollup": "^2.33.3",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-uglify": "^6.0.4",
"rollup-plugin-visualizer": "^4.0.4",
"rollup-plugin-visualizer": "^4.2.0",
"styled-components": "^5.0.1",
"stylelint": "^13.3.3",
"stylelint": "^13.8.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"typescript": "^3.9.7"
"ts-jest": "^26.4.4",
"typescript": "^4.0.5"
},
"dependencies": {
"deepmerge": "^4.2.2",
Expand Down
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react",
"sourceMap": true,
"target": "es5",
"experimentalDecorators": true,
"declaration": false,
"removeComments": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "build",
"lib": [
"es6",
"es7",
"dom"
],
"baseUrl": "src",
"allowSyntheticDefaultImports": true,
},
}
Loading

0 comments on commit d68db2a

Please sign in to comment.