'typescript + eslint + babel issue in expo project: lots of Parsing errors
eslint is giving me a really hard time
> Parsing error: The keyword 'const' is reserved. :eslint
> Parsing error: The keyword 'import' is reserved. :eslint
.eslintrc.js
const eslintConfig = require("@ourCompany/eslint-config");
module.export = {
...eslintConfig,
root: true,
env: {
es6: true,
node: true,
jest: true,
browser: true,
commonjs: true,
},
parser: "@babel/eslint-parser",
parserOptions: {
files: ["*.ts", "*.tsx"],
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module",
project: "./tsconfig.json",
},
plugins: [...eslintConfig.plugins, "@typescript-eslint"],
extends: [
...eslintConfig.extends,
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
],
};
tsconfig.json
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"baseUrl": ".",
"paths": {
"~*": ["./*"]
},
"types": ["node", "jest"]
}
}
babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
[
"module-resolver",
{
alias: {
["~"]: "./",
},
},
],
],
};
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
