This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/@vue/cli-plugin-eslint/ui/index.js

41 lines
1 KiB
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
const configDescriptor = require('./configDescriptor')
const taskDescriptor = require('./taskDescriptor')
const CONFIG = 'org.vue.eslintrc'
const OPEN_ESLINTRC = 'org.vue.eslint.open-eslintrc'
module.exports = api => {
api.describeConfig(configDescriptor.config)
api.describeTask(taskDescriptor.task)
api.onViewOpen(({ view }) => {
if (view.id !== 'vue-project-configurations') {
removeSuggestions()
}
})
api.onConfigRead(({ config }) => {
if (config.id === CONFIG) {
api.addSuggestion({
id: OPEN_ESLINTRC,
type: 'action',
label: 'org.vue.eslint.suggestions.open-eslintrc.label',
handler () {
const file = config.foundFiles.eslint.path
const { launch } = require('@vue/cli-shared-utils')
launch(file)
return {
keep: true
}
}
})
} else {
removeSuggestions()
}
})
function removeSuggestions () {
[OPEN_ESLINTRC].forEach(id => api.removeSuggestion(id))
}
}