diff --git a/.eslintignore b/.eslintignore index db4c6d9..437c601 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist -node_modules \ No newline at end of file +node_modules +src/views/course/spritetext.js diff --git a/.eslintrc copy.cjs b/.eslintrc copy.cjs new file mode 100644 index 0000000..444ba89 --- /dev/null +++ b/.eslintrc copy.cjs @@ -0,0 +1,66 @@ +// @see https://eslint.bootcss.com/docs/rules/ + +module.exports = { + env: { + browser: true, + es2021: true, + node: true, + jest: true, + jquery: true, + }, + globals: { + VANTA: 'readonly', //VANTA 已经cdn引入 这里拒绝eslint报错 全局声明一下 + ElMessage: 'readonly', + ElMessageBox: 'readonly', + ElLoading: 'readonly', + }, + /* 指定如何解析语法 */ + parser: 'vue-eslint-parser', + /** 优先级低于 parse 的语法解析配置 */ + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + parser: '@typescript-eslint/parser', + jsxPragma: 'React', + ecmaFeatures: { + jsx: true, + }, + }, + /* 继承已有的规则 */ + extends: [ + 'eslint:recommended', + 'plugin:vue/vue3-essential', + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', + ], + plugins: ['vue', '@typescript-eslint'], + /* + * "off" 或 0 ==> 关闭规则 + * "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行) + * "error" 或 2 ==> 规则作为一个错误(代码不能执行,界面报错) + */ + rules: { + // eslint(https://eslint.bootcss.com/docs/rules/) + 'no-var': 'error', // 要求使用 let 或 const 而不是 var + 'no-multiple-empty-lines': ['warn', { max: 1 }], // 不允许多个空行 + 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + 'no-unexpected-multiline': 'error', // 禁止空余的多行 + 'no-useless-escape': 'off', // 禁止不必要的转义字符 + + // typeScript (https://typescript-eslint.io/rules) + '@typescript-eslint/no-unused-vars': 'error', // 禁止定义未使用的变量 + '@typescript-eslint/prefer-ts-expect-error': 'off', // 禁止使用 @ts-ignore + '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/no-explicit-any': 'off', // 禁止使用 any 类型 + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-namespace': 'off', // 禁止使用自定义 TypeScript 模块和命名空间。 + '@typescript-eslint/semi': 'off', + + // eslint-plugin-vue (https://eslint.vuejs.org/rules/) + 'vue/multi-word-component-names': 'off', // 要求组件名称始终为 “-” 链接的单词 + 'vue/script-setup-uses-vars': 'error', // 防止 \ No newline at end of file + diff --git a/src/views/MyCourseStudy/courseCollections.vue b/src/views/MyCourseStudy/courseCollections.vue index 01bf227..3bc70f3 100644 --- a/src/views/MyCourseStudy/courseCollections.vue +++ b/src/views/MyCourseStudy/courseCollections.vue @@ -153,7 +153,7 @@ import { ref, watch } from 'vue' import type { TabsPaneContext } from 'element-plus' import ContainerCla from './ContainerCla.vue' import ContainerKno from './ContainerKno.vue' -import { getAssApi } from '@/api/courseChaptersApi' +// import { getAssApi } from '@/api/courseChaptersApi' import { SeResourceFavourControllerService } from '../../../generated/services/SeResourceFavourControllerService' const centerDialogVisible = ref(false) @@ -176,10 +176,10 @@ const currentPage1 = ref(1) const pageSize1 = ref(10) const disabled = ref(false) -const handleSizeChange = (val: number) => { +const handleSizeChange = () => { getDatalist() } -const handleCurrentChange = (val: number) => { +const handleCurrentChange = () => { getDatalist() } @@ -189,7 +189,7 @@ function initFenYie() { pageSize1.value = 10 } -watch(activeIndex, (newVal) => { +watch(activeIndex, () => { initFenYie() getDatalist() }) diff --git a/src/views/course/spritetext.js b/src/views/course/spritetext.js index 57ccb06..fad89eb 100644 --- a/src/views/course/spritetext.js +++ b/src/views/course/spritetext.js @@ -19,7 +19,7 @@ function _callSuper(t, o, e) { } function _isNativeReflectConstruct() { try { - var t = !Boolean.prototype.valueOf.call( + let t = !Boolean.prototype.valueOf.call( Reflect.construct(Boolean, [], function () {}), ) } catch (t) {} @@ -190,7 +190,7 @@ function _unsupportedIterableToArray(o, minLen) { } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i] + for (let i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i] return arr2 } function _nonIterableSpread() { diff --git a/src/views/portal/LearningPathRecommendations.vue b/src/views/portal/LearningPathRecommendations.vue index c836a1c..1226daf 100644 --- a/src/views/portal/LearningPathRecommendations.vue +++ b/src/views/portal/LearningPathRecommendations.vue @@ -34,7 +34,7 @@ -
+ @@ -54,531 +54,531 @@
-