Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Use object shorthand or index signatures being applied to JavaScript files #2106

Open
franklygeorgy opened this issue Feb 15, 2024 · 0 comments

Comments

@franklygeorgy
Copy link

warning Use object shorthand or index signatures instead of `Object`, e.g., `{[key: string]: string}` jsdoc/check-types is being applied to our JavaScript files. Either the example given is wrong for JavaScript or this doesn't apply to JavaScript at all. We don't want to follow this directive anyways so having an option to toggle it off would be appreciated.

Input code

/**
 * brand
 *
 * @type {Object.<string, string>}
 */

JSDoc configuration

Our JSDoc is configured via a .eslintrc.json file

{
	"root": true,
	"env": {
		"browser": true,
		"es6": true,
		"jquery": true
	},
	"extends": ["eslint:recommended"],
	"plugins": [
		"jsdoc",
		"sonarjs"
	],
	"globals": {
		"SugarCube": false,
		"Config": false,
		"State": false,
		"Story": false,
		"settings": false,
		"setup": false,
		"App": false,
		"prehistory": true,
		"predisplay": true,
		"prerender": true,
		"postrender": true,
		"postdisplay": true
	},
	"parserOptions": {
		"ecmaVersion": 2021,
		"sourceType": "script",
		"ecmaFeatures": {
			"impliedStrict": true
		}
	},
	"overrides": [
		{
			// overrides for helper scripts that are written
			// using imports and/or exports
			"files": ["gulpfile.js", "devTools/scripts/*.js"],
			"parserOptions": {
				"sourceType": "module",
				"ecmaVersion": 2022
			}
		}
	],
	"settings": {
		"jsdoc": {
			"mode": "typescript"
		}
	},
	"rules": {
		"no-prototype-builtins": "off",
		"semi": ["warn", "always"],
		"semi-spacing": "warn",
		"semi-style": "warn",
		"block-spacing": ["warn", "always"],
		"curly": ["warn", "all"],
		"eqeqeq": ["warn", "smart"],
		"space-before-function-paren": ["warn", {
			"anonymous": "never",
			"named": "never",
			"asyncArrow": "always"
		}],
		"template-curly-spacing": ["warn", "never"],
		"no-trailing-spaces": "warn",
		"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
		"no-unneeded-ternary": "warn",
		"camelcase": "warn",
		"padded-blocks": ["warn", "never"],
		"comma-spacing": "warn",
		"comma-style": "warn",
		"object-curly-newline": ["warn",
			{
				"ObjectExpression":{
					"minProperties": 4,
					"consistent": true
				},
				"ImportDeclaration": {
					"minProperties": 4,
					"consistent": true
				},
				"ExportDeclaration": {
					"minProperties": 4,
					"consistent": true
				},
				"ObjectPattern": {
					"minProperties": 8,
					"consistent": true
				}
			}
		],
		"object-curly-spacing": "warn",
		"no-var": "warn",
		"spaced-comment": "warn",
		"no-undef": "off",
		"indent": ["error", "tab", { "SwitchCase": 1 }],
		"no-unused-vars": ["error", {"args": "none"}],
		"no-unused-expressions": "error",
		"block-scoped-var": "error",
		"dot-notation": "warn",
		"eol-last": "warn",
		"unicode-bom": [
			"error",
			"never"
		],
		"brace-style": [
			"warn",
			"1tbs",
			{
				"allowSingleLine": true
			}
		],
		"no-sequences": "warn",
		"no-unreachable-loop": "warn",
		"generator-star-spacing": [
			"warn",
			{
				"before": false,
				"after": true,
				"anonymous": "neither"
			}
		],
		"one-var": ["warn", "never"],
		"keyword-spacing": "warn",
		"no-template-curly-in-string": "error",
		"operator-linebreak": ["warn", "after", { "overrides": { "?": "before", ":": "before" }}],
		"jsdoc/check-alignment": 1,
		"jsdoc/check-examples": 0, // interferes with SugarCube examples
		"jsdoc/check-indentation": 0,
		"jsdoc/check-param-names": 1,
		"jsdoc/check-property-names": 1,
		"jsdoc/check-syntax": 1,
		"jsdoc/check-tag-names": 1,
		"jsdoc/check-types": 1,
		"jsdoc/implements-on-classes": 1,
		"jsdoc/match-description": 0, // rejects SugarCube syntax
		"jsdoc/newline-after-description": 0,
		"jsdoc/no-types": 0,
		"jsdoc/no-undefined-types": 0,
		"jsdoc/require-jsdoc": 0,
		"jsdoc/require-param": 0,
		"jsdoc/require-param-description": 0,
		"jsdoc/require-param-name": 1,
		"jsdoc/require-param-type": 1,
		"jsdoc/require-returns": 0,
		"jsdoc/require-returns-check": 1,
		"jsdoc/require-returns-description": 0,
		"jsdoc/require-returns-type": 1,
		"jsdoc/valid-types": 1,
		"sonarjs/no-all-duplicated-branches": "error",
		"sonarjs/no-element-overwrite": "error",
		"sonarjs/no-extra-arguments": "error",
		"sonarjs/no-identical-conditions": "error",
		"sonarjs/no-identical-expressions": "error",
		"sonarjs/no-one-iteration-loop": "error",
		"sonarjs/no-use-of-empty-return-value": "error",
		"sonarjs/no-collection-size-mischeck": "warn",
		"sonarjs/no-same-line-conditional": "warn",
		"sonarjs/no-unused-collection": "warn"
	}
}

Expected behavior

Current behavior

Your environment

Software Version
JSDoc Whatever version eslint-plugin-jsdoc 46.0.0 pulls
Node.js v20.10.0
npm 10.2.3
Operating system Windows 10 and Garuda Linux (Arch)
@franklygeorgy franklygeorgy changed the title BUG: Use object shorthand or index signatures being applied to JavaScript file BUG: Use object shorthand or index signatures being applied to JavaScript files Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant