nzakas on main
docs: use shorthand property na… (compare)
$ /analyzer run
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ GitLab ESLint analyzer v2.25.1
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Detecting project
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Found relevant files in project, analyzing entire repository
[INFO] [ESLint] [2022-04-05T13:37:24Z] ▶ Running analyzer
Oops! Something went wrong! :(
ESLint: 7.32.0
RangeError: Invalid string length
at JSON.stringify (<anonymous>)
at module.exports (/home/node/node_modules/eslint/lib/cli-engine/formatters/json.js:12:17)
at Object.format (/home/node/node_modules/eslint/lib/eslint/eslint.js:648:24)
at printResults (/home/node/node_modules/eslint/lib/cli.js:181:30)
at async Object.execute (/home/node/node_modules/eslint/lib/cli.js:316:13)
at async main (/home/node/node_modules/eslint/bin/eslint.js:132:24)
[DEBU] [ESLint] [2022-04-05T13:39:30Z] ▶ /home/node/node_modules/.bin/eslint -c /home/node/.eslintrc --no-eslintrc --ext .html,.js,.jsx,.ts,.tsx -f json . --resolve-plugins-relative-to /home/node
[ERRO] [ESLint] [2022-04-05T13:39:30Z] ▶ An error occurred while running eslint: exit status 2
Hello guys, maybe you know better than me and the solution is very easy:
I installed eslint globally:
npm i eslint@6.8.0 -g
Then I also installed globally eslint-config-google:
npm i eslint-config-google -g
But when I run the command:
npm run lint
I get this error:
Oops! Something went wrong! :(
ESLint: 6.8.0.
ESLint couldn't find the config "google" to extend from. Please check that the name of the config is correct.
My configuration contains:
"extends": [
"google"
],
Logs:
eslint:cli CLI args: [ './', '--fix', '--debug' ] +0ms
eslint:cli Running on files +4ms
eslintrc:config-array-factory Loading JSON config file: /source/package.json +0ms
eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/source', loose: false } ] +0ms
eslintrc:ignore-pattern processed: { basePath: '/source', patterns: [ '/**/node_modules/*' ] } +1ms
eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/source', loose: false } ] +1ms
eslintrc:ignore-pattern processed: { basePath: '/source', patterns: [ '/**/node_modules/*' ] } +0ms
eslint:file-enumerator Start to iterate files: [ './' ] +0ms
eslint:file-enumerator Directory: /source +1ms
eslint:file-enumerator Enter the directory: /source +0ms
eslintrc:cascading-config-array-factory Load config files for /source. +0ms
eslintrc:cascading-config-array-factory No cache found: /source. +0ms
eslintrc:config-array-factory Loading JSON config file: /source/.eslintrc.json +6ms
eslintrc:config-array-factory Config file found: /source/.eslintrc.json +1ms
eslintrc:config-array-factory Loading {extends:"google"} relative to /source/.eslintrc.json +0ms
ESLint couldn't find the config "developit" to extend from. Please check that the name of the config is correct.
The config "developit" was referenced from the config file in "/node_modules/@babel/preset-modules/package.json".
So my linting is passing, but I'm not sure it should. CJS node16 build
eslintrc.json:
{
"plugins": [
"jest",
"import"
],
"env": {
"node": true,
"jest/globals": true
},
"extends": [
"standard",
"plugin:import/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 12,
"requireConfigFile": false
},
"rules": {
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline"
}
],
"eqeqeq": "off",
"no-case-declarations": "off",
"import/named": "error"
}
}
package.json:
{
"devDependencies": {
"@babel/core": "^7.17.10",
"@babel/eslint-parser": "^7.17.0",
"@babel/preset-env": "^7.17.10",
"babel-jest": "^28.1.0",
"eslint": "^8.15.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-curry": "^0.1.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.2.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"jest": "^28.1.0",
}
}
export.js (in /lib/export
:
exports.someMethodName = () => {};
consuming code:
const { someMethodNameNotCorrect } = require('../lib/export');
exports.SomeOtherThing = () { someMethodNameNotCorrect;
I'd expect a import/named
error in the consuming code; however this passes linting. Other than changing to ESM, is there an option that throws an error here?
I am using eslint-config-react-native-community.
I had prettier extension installed in VS Code. I want my extension to decide things for me everywhere except the react native project I am working on.
So, I added a file name .prettierignore in the root folder and added an asterisk inside. I am not sure if this is the right way to do it.
Earlier, I was getting errors from eslint like "react/react-in-jsx-scope", "semi" and "prettier/prettier". Now, there is no "prettier/prettier" errors. Did I do something wrong? Please help me to separate my extension prettier and the prettier I installed with
npm i -D eslint prettier @react-native-community/eslint-config
I am using eslint-config-react-native-community.
I had prettier extension installed in VS Code. I want my extension to decide things for me everywhere except the react native project I am working on.
So, I added a file name .prettierignore in the root folder and added an asterisk inside. I am not sure if this is the right way to do it.
Earlier, I was getting errors from eslint like "react/react-in-jsx-scope", "semi" and "prettier/prettier". Now, there is no "prettier/prettier" errors. Did I do something wrong? Please help me to separate my extension prettier and the prettier I installed with
npm i -D eslint prettier @react-native-community/eslint-config
Got the answer right after this. So, I just disabled the prettier extension for the workspace I was working on. And voila it worked. .prettierignore was disabling both the extension as well as the local prettier I installed with eslint.
import/no-cycle
is overriding my settings['import/resolver']
somehow. I have a settings['import/resolver'].typescript
, and if I activate no-cycle
, some rules behave differently as if they're failing to resolve correctly.
rules/no-cycle.js
, it does import `eslint-module-utils/resolve and does some tricks with that. But I can't see why it would affect other rules.
no-cycle
(which I guess prefers the node resolver) seems to change what type info is available to other rules. For instance restrict-plus-operands
comes alive when I activate no-cycle
, finding several variables with unclear types. Some of those lint errors are actually legit, while others are from broken type inference. Without no-cycle
, I don't get any of those errors. This is a monorepo with the typescript resolver.
node
is there and is also last
@ljharb Aha, no I had them ordered alphabetically. It doesn't seem to make a difference though.
The structure is (hope this makes sense):.eslintrc.settings['import/resolver'].typescript.project: ['tsconfig.eslint.json']
.eslintrc.overrides: [<files regex for eachPackage>].settings.['import/resolver'].typescript.project = ['./' + eachPackage + '/tsconfig.json']
All these tsconfig.json extend a tsconfig.base.json.
As you suggested, I added next to "typescript" in each override, below typescript: node.paths = ['./' + eachPackage + '/src']
.
no-cycle
and order
are super slow. Would you be interested in PRs that optimize them (assuming I could find something), if they use more memory and/or cache things at module scope? Or are there strict guidelines for how to use memory, meaning that these tasks are unsuitable for newcomers?
"lint-staged": {
".{ts,tsx}": [
"node --max_old_space_size=8192 ./node_modules/.bin/eslint --fix --color --cache --quiet"
],
".{js,jsx,mjs,mjsx,cjs,cjsx}": [
"node --max_old_space_size=8192 ./node_modules/.bin/eslint --fix --color --cache --quiet"
]
}
throw an Error SyntaxError: missing ) after argument list