github-pages-deploy-action/node_modules/eslint-plugin-github/lib/rules/unused-module.js

25 lines
444 B
JavaScript
Raw Normal View History

2020-03-07 11:45:40 +08:00
const {entries, imported} = require('../dependency-graph')
module.exports = {
meta: {
docs: {}
},
create(context) {
const filename = context.getFilename()
if (entries.has(filename)) {
return {}
}
return {
Program(node) {
const {filenames} = imported()
if (!filenames.has(filename)) {
context.report(node, 'Module was not imported by any files.')
}
}
}
}
}