diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 65c1caa3..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,59 +0,0 @@ -module.exports = { - env: { - browser: true, - jest: true - }, - parserOptions: { - ecmaVersion: 'latest' - }, - extends: [ - 'eslint-config-airbnb-base', - 'plugin:vue/vue3-recommended', - 'plugin:jsdoc/recommended' - ], - rules: { - 'linebreak-style': 'off', - 'vue/component-definition-name-casing': ['warn', 'kebab-case'], - 'vue/require-default-prop': 'off', - 'vue/attribute-hyphenation': ['warn', 'never'], - 'vue/v-on-event-hyphenation': ['warn', 'never'], - 'object-curly-newline': ['error', { consistent: true }], - 'function-paren-newline': ['error', 'multiline'], - 'operator-linebreak': ['error', 'before', { overrides: { '=': 'after' } }], - 'implicit-arrow-linebreak': ['off'], - 'comma-dangle': ['error', 'never'], - indent: ['error', 4, { SwitchCase: 1 }], - 'max-len': ['error', { code: 160 }], - 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], - 'vue/html-indent': 'off', - 'vue/html-closing-bracket-newline': ['error', { - singleline: 'never', - multiline: 'never' - }], - 'jsdoc/check-tag-names': ['error', { - definedTags: ['store', 'endpoint', 'category', 'subcategory', 'remarks'] - }], - 'jsdoc/require-jsdoc': 0, - 'vue/html-self-closing': ['error', { - html: { - void: 'any', - normal: 'any', - component: 'any' - }, - svg: 'always', - math: 'always' - }], - 'import/extensions': ['error', 'always', { js: 'ignorePackages' }], - 'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['item'] }], - 'no-restricted-syntax': ['off', 'ForOfStatement'], - 'no-return-await': 'off' - }, - settings: { - 'import/resolver': { - alias: { - map: [['@', './src/']], - extensions: ['.js', '.vue'] - } - } - } -}; \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..fa27591e --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,149 @@ +import { globalIgnores } from 'eslint/config'; +import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'; +import pluginVue from 'eslint-plugin-vue'; +// import pluginVitest from '@vitest/eslint-plugin'; +import js from '@eslint/js'; +import globals from 'globals'; +import stylistic from '@stylistic/eslint-plugin'; +import jsdoc from 'eslint-plugin-jsdoc'; + +export default defineConfigWithVueTs( + { + name: 'app/files-to-lint', + files: ['**/*.{vue,ts,js,mts,tsx}'], + }, + + js.configs.recommended, + jsdoc.configs['flat/recommended-mixed'], + + // Add @stylistic configuration + stylistic.configs.customize({ + indent: 4, + quotes: 'single', + semi: true, + // Add any other stylistic preferences here + }), + + ...pluginVue.configs['flat/essential'], + vueTsConfigs.recommended, + { + name: 'app/global-rules', + files: ['**/*.{js,ts,vue}'], + rules: { + 'eqeqeq': ['error', 'smart'], + 'no-nested-ternary': 'error', + 'no-param-reassign': 'error', + 'jsdoc/require-jsdoc': 'off', + '@stylistic/comma-dangle': 'off', + '@stylistic/max-len': ['error', { + code: 160, + tabWidth: 4, + ignoreUrls: true, + ignoreStrings: true, + ignoreTemplateLiterals: true + }], + + 'vue/max-len': ['error', { + code: 160, + template: 160, + tabWidth: 4, + ignoreUrls: true, + ignoreStrings: true, + ignoreTemplateLiterals: true, + ignoreHTMLTextContents: false + }], + } + }, + + { + name: 'app/custom-vue-rules', + files: ['**/*.vue'], + rules: { + 'vue/block-lang': ['error', { + script: { + lang: ['js', 'ts'], + allowNoLang: true // Still allow + + \ No newline at end of file diff --git a/src/layouts/address-lookup/address-lookup.spec.js b/src/layouts/address-lookup/address-lookup.spec.js index 1bae7462..648190c2 100644 --- a/src/layouts/address-lookup/address-lookup.spec.js +++ b/src/layouts/address-lookup/address-lookup.spec.js @@ -167,9 +167,7 @@ describe('address-lookup.vue', () => { expect(wrapper.findComponent({ ref: 'alertMatchedTwoIdenticalYMMVehicle' }).isVisible()).toBe(true); }); - // eslint-disable-next-line max-len - test( - 'if the looking up VIN by address is not allowed in the state selected display the Vin Lookup By HomeAddress Not Allowed Alert', + test('if the looking up VIN by address is not allowed in the state selected display the Vin Lookup By HomeAddress Not Allowed Alert', async () => { // Arrange const mockRegistrationAddress = { @@ -364,9 +362,7 @@ describe('address-lookup.vue', () => { ); }); - // eslint-disable-next-line max-len - test( - 'if a different vehicle is found than the one entered and the selected glass is not available for that vehicle, navigate back to vehicle-damage page', + test('if a different vehicle is found than the one entered and the selected glass is not available for that vehicle, navigate back to vehicle-damage page', async () => { // Arrange const mockRegistrationAddress = { diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 60ff5199..cf6e6e4c 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -14,9 +14,11 @@ ref="siteSubHeader" cmsWidgetName="SiteSubHeaderWidget" class="mt-4" /> - +
+ +
span:first-child) { + text-transform: uppercase; +} diff --git a/src/layouts/address-vehicles/address-vehicles.spec.js b/src/layouts/address-vehicles/address-vehicles.spec.js index 542e9a0d..a1016855 100644 --- a/src/layouts/address-vehicles/address-vehicles.spec.js +++ b/src/layouts/address-vehicles/address-vehicles.spec.js @@ -100,6 +100,9 @@ function setupMocks({ if (contentName === 'ProvideVinAlert') { return 'ProvideVinAlertTestReturn'; } + if (contentName === 'VehicleConfirmationQuestion') { + return 'VehicleConfirmationQuestionTestReturn'; + } return null; }) }, @@ -190,9 +193,7 @@ describe('address-vehicles.vue', () => { expect(wrapper.vm.forwardButtonAction).toReturn; }); - // eslint-disable-next-line max-len - test( - 'Should navigate to CLICKED_FORWARD scenario if carId is different and selected glass not available for vehicle on navigateForward', + test('Should navigate to CLICKED_FORWARD scenario if carId is different and selected glass not available for vehicle on navigateForward', async () => { // Arrange const { wrapper } = setupMocks({}); diff --git a/src/layouts/address-vehicles/address-vehicles.vue b/src/layouts/address-vehicles/address-vehicles.vue index 3740b674..412072cc 100644 --- a/src/layouts/address-vehicles/address-vehicles.vue +++ b/src/layouts/address-vehicles/address-vehicles.vue @@ -13,15 +13,6 @@ - { const maskSymbol = '*'; - const vinStart = maskSymbol.repeat(v.vin.length - 6); + const vinStart = maskSymbol.repeat(6); const vinEnd = v.vin.substring(v.vin.length - 6); return { vin: v.vin, @@ -235,13 +225,6 @@ export default { } else { this.displayMatchedDifferentVehicleAlert = true; } - this.$refs.siteFooter.updateButtonText(`Continue with ${this.selectedVehicle.vehicle.year} ` - + `${this.selectedVehicle.vehicle.make} ${this.selectedVehicle.vehicle.model} ${this.forwardButtonCarStyle}`); - } else { - this.$refs.siteFooter.updateButtonText(this.getCmsContent( - 'SiteFooterWidget', - 'ForwardButtonText' - )); } }, deep: true diff --git a/src/layouts/bailout-page/bailout-page.vue b/src/layouts/bailout-page/bailout-page.vue index db6aa074..b5000ce6 100644 --- a/src/layouts/bailout-page/bailout-page.vue +++ b/src/layouts/bailout-page/bailout-page.vue @@ -108,7 +108,6 @@ export default { siteSubHeader, siteFooter, textboxQuestion, - // eslint-disable-next-line vue/no-reserved-component-names Form, textBlock }, diff --git a/src/layouts/capability-questions/capability-questions.spec.js b/src/layouts/capability-questions/capability-questions.spec.js index 7f970443..d8b19833 100644 --- a/src/layouts/capability-questions/capability-questions.spec.js +++ b/src/layouts/capability-questions/capability-questions.spec.js @@ -29,9 +29,7 @@ const baseStoreGettersPageData = () => ({ capabilityQuestions: [ { questionSequence: 1, - questionText: - // eslint-disable-next-line max-len - 'Is your vehicle equipped with the optional Lane-Keeping System which tugs on the steering wheel and/or beeps to alert you if you drift too close to the edge of the lane?', + questionText: 'Is your vehicle equipped with the optional Lane-Keeping System which tugs on the steering wheel and/or beeps to alert you if you drift too close to the edge of the lane?', answers: [ { answerResult1: 'DYNAMIC', @@ -67,17 +65,13 @@ const baseStoreGettersDamage = () => ({ result: 'FW04848', answeredQuestions: [ { - questionText: - // eslint-disable-next-line max-len - 'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?', + questionText: 'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?', selectedAnswer: '1|nextQuestion|3|Yes', selectedAnswerText: 'Yes', questionNum: 1 }, { - questionText: - // eslint-disable-next-line max-len - 'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?', + questionText: 'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?', selectedAnswer: '2|nextQuestion|3|Yes', selectedAnswerText: 'Yes', questionNum: 2 @@ -212,17 +206,13 @@ describe('capabilityQuestions.vue', () => { answerResult: 'FW04848', answeredQuestions: [ { - questionText: - // eslint-disable-next-line max-len - 'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?', + questionText: 'Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?', selectedAnswer: '1|nextQuestion|3|Yes', selectedAnswerText: 'Yes', questionNum: 1 }, { - questionText: - // eslint-disable-next-line max-len - 'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?', + questionText: 'Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?', selectedAnswer: '2|nextQuestion|3|Yes', selectedAnswerText: 'Yes', questionNum: 2 diff --git a/src/layouts/capability-questions/capability-questions.vue b/src/layouts/capability-questions/capability-questions.vue index 494fcacd..f6f4c8a0 100644 --- a/src/layouts/capability-questions/capability-questions.vue +++ b/src/layouts/capability-questions/capability-questions.vue @@ -35,7 +35,6 @@ import questionsPageLayout from '@/iss-components/questions-page-layout/question export default { name: 'capability-questions', components: { - // eslint-disable-next-line vue/no-reserved-component-names Form, questionsPageLayout }, diff --git a/src/layouts/contact-details/contact-details.vue b/src/layouts/contact-details/contact-details.vue index c28d0d3a..5a84b8f3 100644 --- a/src/layouts/contact-details/contact-details.vue +++ b/src/layouts/contact-details/contact-details.vue @@ -59,7 +59,7 @@ inputId="state" class="form-group" :cmsWidgetName="widget.stateQuestion" - :options="states" + :options="getStates" isDisabled /> { + acc[key] = states[key].toUpperCase(); + return acc; + }, {}); + }, }, watch: { isSameAsPolicyAddress(newValue) { diff --git a/src/layouts/coverage-statement/cancel-claim-modal/cancel-claim-modal.vue b/src/layouts/coverage-statement/cancel-claim-modal/cancel-claim-modal.vue index 3427620d..fb208e76 100644 --- a/src/layouts/coverage-statement/cancel-claim-modal/cancel-claim-modal.vue +++ b/src/layouts/coverage-statement/cancel-claim-modal/cancel-claim-modal.vue @@ -1,4 +1,3 @@ -