Я занимаюсь разработкой приложения nodejs
. Я пытаюсь настроить файл webpack.config. js для выдачи ошибок ts
и eslint
. Но при запуске команда build получила сообщения без ошибок.
команда построения:
"build": "webpack --watch --mode=development"
webpack.confog. js:
/* eslint-disable */
const path = require('path')
const { CheckerPlugin } = require('awesome-typescript-loader')
const { NODE_ENV = 'production' } = process.env
module.exports = {
entry: {
collectDayMatches: './src/collectDayMatches.ts',
},
mode: NODE_ENV,
target: 'node',
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name].js',
},
resolve: {
extensions: ['.ts', '.js'],
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.(tsx|ts)?$/,
loader: 'awesome-typescript-loader',
options: {
transpileOnly: true,
experimentalWatchApi: true,
},
},
{
test: /\.(ts)$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
emitError: true,
emitWarning: true,
configFile: '../../../.eslintrc',
},
},
],
},
plugins: [new CheckerPlugin()],
}
.eslinrr c (я делюсь им с приложением реагирования):
{
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'airbnb-typescript',
'airbnb/hooks',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
'airbnb-typescript-prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['react', '@typescript-eslint'],
rules: {
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
'no-console': ['error', { allow: ['error'] }],
'react/no-did-update-set-state': 1,
'react/jsx-props-no-spreading': 1,
'no-underscore-dangle': ['error', { allow: ['__typename'] }],
'jsx-a11y/label-has-associated-conrol': 0,
'@typescript-eslint/no-unnecessary-type-assertion': 0,
'@typescript-eslint/no-misused-promises': 0,
'@typescript-eslint/require-await': 'off',
'import/prefer-default-export': 'off',
'jsx-a11y/anchor-is-valid': 0,
'react/state-in-constructor': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'object-curly-newline': 0,
'max-len': ['error', { code: 120, ignorePattern: '^import|d="' }],
'react/destructuring-assignment': 0,
'@typescript-eslint/member-delimiter-style': 0,
'import/no-unresolved': 0,
'@typescript-eslint/semi': ['error', 'never'],
'import/no-extraneous-dependencies': 0,
'react/jsx-filename-extension': [2, { extensions: ['.tsx'] }],
'react/prop-types': 0,
'@typescript-eslint/interface-name-prefix': ['error', { prefixWithI: 'always', allowUnderscorePrefix: false }],
},
globals: {},
settings: {
react: {
pragma: 'React',
version: 'detect',
},
},
}
tsconfig. json
{
"compilerOptions": {
"skipLibCheck": true,
"sourceMap": true,
"target": "es2018",
"jsx": "react",
"module": "esnext",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"moduleResolution": "node",
"declaration": false,
"removeComments": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"outDir": "build",
"noUnusedLocals": true,
"lib": ["es6", "es7", "dom"],
"typeRoots": ["node_modules/@types"]
},
"exclude": ["build", "node_modules"]
}