Closed maxmilton closed 11 months ago
Yes, given the flat config has not been widely supported in the community, I'm 👍 to support both. will make a PR later.
Update: to use eslint-plugin-security v2 with eslintrc configs, just use recommended-legacy
:
module.exports = {
extends: ['plugin:security/recommended-legacy'],
};
The same problem appears to be there with release 2.1.0
This is my .eslintrc.js
file:
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:security/recommended",
"plugin:react-hooks/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react", "@typescript-eslint", "security"],
rules: {},
settings: {
react: {
pragma: "React", // Pragma to use, default to "React"
version: "detect", // React version. "detect" automatically picks the version you have installed.
},
},
};
I still get
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'security' -> object with constructor 'Object'
| property 'configs' -> object with constructor 'Object'
| property 'recommended' -> object with constructor 'Object'
--- property 'plugins' closes the circle
My configuration works with release 1.7.1
@StefanFl the eslintrc config has renamed to recommended-legacy
, see https://github.com/eslint-community/eslint-plugin-security?tab=readme-ov-file#eslintrc-config-deprecated.
@aladdin-add Thank you for the clarification, that works for the moment and now I start changing the configuration to the more modern way.
What version of eslint-plugin-security are you using?
2.0.0
ESLint Environment
Node version:
21.4.0
, Bun:1.0.18
npm version:9.8.1
, pnpm:8.12.1
Local ESLint version:8.55.0
Global ESLint version: none Operating System: Arch Linux;Linux 6.6.6-arch1-1 x86_64 unknown
What parser are you using?
Default (Espree)
What did you do?
Configuration
package.json
:What did you expect to happen?
ESLint config is loaded correctly and ESLint runs without error.
What actually happened?
Participation
Additional comments
A circular reference in the ESLint config was introduced in https://github.com/eslint-community/eslint-plugin-security/pull/118. This causes ESLint to error upon loading the config, when the user config is supplied as anything other than a "flat eslint config"; JS with
require('eslint-plugin-security').configs.recommended
.The ESLint flat config is fine to support, however, it should not come at the expense of the regular config variants e.g.,
package.json#eslintConfig
,.eslintrc
.Please support both flat config and regular configs.