I created a project using Rollup which use Typescript and ESLint with the typescript-eslint plugin and it seems that ESLint is executed on compiled code.
Here is my Rollup config :
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' }), // to allow import of html files (for templating)
image(), // to allow import of image files
isProduction && terser(),
isProduction && filesize(),
serving && serve({
open: true,
openPage: '/index.html',
contentBase: ['demo', 'dist'],
})
]
}
}
Here is my main.ts :
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;
}
And this is what ESLint logs :
.../src/main.ts
4:16 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
4:36 warning Argument 'target' should be typed @typescript-eslint/explicit-module-boundary-types
As you can see, both line numbers and errors are wrong, as if it use the generated js file rather than the ts source. What is the problem here ?