diff --git a/.editorconfig b/.editorconfig index c330281..ca01602 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.eslintrc.js b/.eslintrc.js index f6861f1..3ea49d2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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/**/*', @@ -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: [ { @@ -35,6 +43,11 @@ module.exports = { }, }, ], + settings: { + 'import/resolver': { + typescript: {}, + }, + }, rules: { 'no-console': 1, 'no-extra-boolean-cast': 0, @@ -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'], }], diff --git a/.github/workflows/mergepr.yml b/.github/workflows/mergepr.yml index 326bec0..386d096 100644 --- a/.github/workflows/mergepr.yml +++ b/.github/workflows/mergepr.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [14.x] env: working-dir: ./ diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 21523cc..289c805 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [14.x] env: working-dir: ./ diff --git a/analyze.config.js b/analyze.config.ts similarity index 95% rename from analyze.config.js rename to analyze.config.ts index bd64940..1588502 100644 --- a/analyze.config.js +++ b/analyze.config.ts @@ -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`, }, diff --git a/babel.config.js b/babel.config.js index 31ae050..ab7c4be 100644 --- a/babel.config.js +++ b/babel.config.js @@ -10,6 +10,7 @@ const config = (api) => { exclude: ['transform-regenerator'], }, ], + '@babel/preset-typescript', ], }; return result; diff --git a/config/storybook/main.js b/config/storybook/main.js index 7caab87..a2a2be6 100644 --- a/config/storybook/main.js +++ b/config/storybook/main.js @@ -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', diff --git a/index.html b/index.html index 030a6ff..11603f8 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,6 @@
- +