I developed a project with Rollup that incorporates Typescript and ESLint along with the typescript-eslint plugin. I've noticed that ESLint is running on compiled code instead of the original source.
Below is my Rollup configuration :
export default commandLineArgs => {
const serving = commandLineArgs.configServe === true;
return {
input: 'src/main.ts',
output: {
file: pkg.main,
format: 'umd',
name: 'bot',
sourcemap: !isProduction
},
plugins: [
eslint({ include: ['src/**/*.js', 'src/**/*.ts'] }),
nodeResolve(),
commonjs(),
typescript({ sourceMap: !isProduction, inlineSources: !isProduction }),
replace({
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development')
}),
scss({
includePaths: ['node_modules/'],
outputStyle: isProduction ? 'compressed' : 'expanded'
}),
html({ include: 'src/**/*.html' }),
image(),
isProduction && terser(),
isProduction && filesize(),
serving && serve({
open: true,
openPage: '/index.html',
contentBase: ['demo', 'dist'],
})
]
}
}
This is my main.ts file:
import './styles/app.scss';
import ChatUI from './ui';
import Chat from './chat';
export default async function init(target: HTMLDivElement): Promise<Chat> {
const ui = new ChatUI(target);
const chat = new Chat(ui);
return chat;
}
The ESLint logs display incorrect line numbers and errors, leading me to believe it's analyzing the generated js file rather than the ts source. What could be causing this issue?