Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epidemian
GitHub Repository: epidemian/eslint-plugin-import
Path: blob/main/src/rules/no-webpack-loader-syntax.js
829 views
1
import moduleVisitor from 'eslint-module-utils/moduleVisitor';
2
import docsUrl from '../docsUrl';
3
4
function reportIfNonStandard(context, node, name) {
5
if (name && name.indexOf('!') !== -1) {
6
context.report(node, `Unexpected '!' in '${name}'. ` +
7
'Do not use import syntax to configure webpack loaders.',
8
);
9
}
10
}
11
12
module.exports = {
13
meta: {
14
type: 'problem',
15
docs: {
16
url: docsUrl('no-webpack-loader-syntax'),
17
},
18
schema: [],
19
},
20
21
create(context) {
22
return moduleVisitor((source, node) => {
23
reportIfNonStandard(context, node, source.value);
24
}, { commonjs: true });
25
},
26
};
27
28