in packages/eslint-plugin-ali/src/rules/no-js-in-ts-project.js [28:62]
create(context) {
const fileName = context.getFilename();
const extName = path.extname(fileName);
const ruleOptions = context.options[0] || {};
let { whiteList = [] } = ruleOptions;
const { autoMerge = true } = ruleOptions;
if (whiteList.length === 0) {
whiteList = DEFAULT_WHITE_LIST;
} else if (autoMerge) {
whiteList = [...new Set([...DEFAULT_WHITE_LIST, ...whiteList])];
}
const whiteListReg = new RegExp(`(${whiteList.join('|')})$`);
if (!whiteListReg.test(fileName) && JS_REG.test(extName)) {
context.report({
loc: {
start: {
line: 0,
column: 0,
},
end: {
line: 0,
column: 0,
},
},
messageId: 'noJSInTSProject',
data: {
fileName,
},
});
}
// Necessary
return {};
},