Skip to content

Commit

Permalink
Add Typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
José Ortiz committed Jan 11, 2022
1 parent 61400cc commit 0136600
Show file tree
Hide file tree
Showing 272 changed files with 7,347 additions and 5,251 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,jsx,vue,html,css}]
[*.{ts,tsx,js,jsx,vue,html,css}]
charset = utf-8
indent_style = space
indent_size = 2
Expand Down
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
'airbnb-base',
'airbnb-typescript/base',
'plugin:vue/vue3-strongly-recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: [
'fp',
'@getify/proper-ternary',
'@typescript-eslint',
],
ignorePatterns: [
'build/**/*',
Expand All @@ -19,9 +23,13 @@ module.exports = {
document: true,
window: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
sourceType: 'module',
project: ['./tsconfig.eslint.json'],
extraFileExtensions: ['.vue'],
},
overrides: [
{
Expand All @@ -35,6 +43,11 @@ module.exports = {
},
},
],
settings: {
'import/resolver': {
typescript: {},
},
},
rules: {
'no-console': 1,
'no-extra-boolean-cast': 0,
Expand Down Expand Up @@ -67,6 +80,7 @@ module.exports = {
'fp/no-delete': 'error',
'fp/no-get-set': 'error',
'@getify/proper-ternary/parens': ['error', { call: false, object: false }],
'@typescript-eslint/consistent-type-imports': 'error',
'vue/multi-word-component-names': ['error', {
ignores: ['Button', 'Carousel', 'Checkbox', 'Confetti', 'Heading', 'Infobox', 'Screen', 'Stepper', 'Timeline', 'Wrapper'],
}],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mergepr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [14.x]

env:
working-dir: ./
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [14.x]

env:
working-dir: ./
Expand Down
2 changes: 1 addition & 1 deletion analyze.config.js → analyze.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineConfig({
],
build: {
lib: {
entry: resolve(__dirname, 'src/library.js'),
entry: resolve(__dirname, 'src/library.ts'),
name: 'b2cMappUiAssets',
fileName: (format) => `b2c-mapp-ui.${format}.js`,
},
Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const config = (api) => {
exclude: ['transform-regenerator'],
},
],
'@babel/preset-typescript',
],
};
return result;
Expand Down
2 changes: 1 addition & 1 deletion config/storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
stories: ['../../src/**/*.stories.@(js|jsx|mdx)'],
stories: ['../../src/**/*.stories.@(ts|js|jsx|mdx)'],
addons: [
'@storybook/addon-docs',
'@storybook/addon-controls',
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ const esModules = ['vue-contenteditable', 'lodash-es'].join('|');
module.exports = {
moduleFileExtensions: [
'js',
'ts',
'vue',
],
transform: {
'^.+\\.vue$': 'vue-jest',
'^.+\\.js$': 'babel-jest',
'^.+\\.(j|t)s$': 'babel-jest',
},
setupFiles: ['<rootDir>/setupTests.js'],
roots: ['<rootDir>/src/components'],
Expand All @@ -18,12 +19,12 @@ module.exports = {
'<rootDir>/src/styles',
],
testMatch: [
'**/*.test.js',
'**/*.spec.js',
'**/*.test.ts',
'**/*.spec.ts',
],
collectCoverageFrom: [
'src/**/*.vue',
'!src/main.js',
'!src/main.ts',
],
verbose: true,
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
Expand Down
Loading

0 comments on commit 0136600

Please sign in to comment.