github-pages-deploy-action/node_modules/eslint-plugin-github/lib/rules/unused-module.js
2020-03-31 08:42:07 -04:00

25 lines
451 B
JavaScript

const depGraph = require('../dependency-graph')
module.exports = {
meta: {
docs: {}
},
create(context) {
const filename = context.getFilename()
if (depGraph.entries.has(filename)) {
return {}
}
return {
Program(node) {
const {filenames} = depGraph.imported()
if (!filenames.has(filename)) {
context.report(node, 'Module was not imported by any files.')
}
}
}
}
}