Expected property shorthand in object literal ('{targets}'). Open
pino.transport({ targets: targets })
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: object-literal-shorthand
Enforces/disallows use of ES6 object literal shorthand.
Notes
- Has Fix
Config
"always"
assumed to be default option, thus with no options provided
the rule enforces object literal methods and properties shorthands.
With "never"
option provided, any shorthand object literal syntax causes an error.
The rule can be configured in a more granular way.
With {"property": "never"}
provided (which is equivalent to {"property": "never", "method": "always"}
),
the rule only flags property shorthand assignments,
and respectively with {"method": "never"}
(equivalent to {"property": "always", "method": "never"}
),
the rule fails only on method shorthands.
Examples
"object-literal-shorthand": true
"object-literal-shorthand": true,never
"object-literal-shorthand": true,[object Object]
Schema
{
"oneOf": [
{
"type": "string",
"enum": [
"never"
]
},
{
"type": "object",
"properties": {
"property": {
"type": "string",
"enum": [
"never"
]
},
"method": {
"type": "string",
"enum": [
"never"
]
}
},
"minProperties": 1,
"maxProperties": 2
}
]
}
For more information see this page.
Multiple imports from 'pino' can be combined into one. Open
import { TransportTargetOptions } from "pino";
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-duplicate-imports
Disallows multiple import statements from the same module.
Rationale
Using a single import statement per module will make the code clearer because you can see everything being imported from that module on one line.
Config
"allow-namespace-imports" allows you to import namespaces on separate lines.
Examples
"no-duplicate-imports": true,[object Object]
Schema
{
"type": "object",
"properties": {
"allow-namespace-imports": {
"type": "boolean"
}
}
}
For more information see this page.
'namespace' and 'module' are disallowed Open
namespace logger {
export type LoggerOptions = {
level?: string;
transportTargetOptions?: TransportTargetOptions;
};
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-namespace
Disallows use of internal module
s and namespace
s.
This rule still allows the use of declare module ... {}
Rationale
ES6-style external modules are the standard way to modularize code.
Using module {}
and namespace {}
are outdated ways to organize TypeScript code.
Notes
- TypeScript Only
Config
One argument may be optionally provided:
-
allow-declarations
allowsdeclare namespace ... {}
to describe external APIs.
Examples
"no-namespace": true
"no-namespace": true,allow-declarations
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"allow-declarations"
]
},
"minLength": 0,
"maxLength": 1
}
For more information see this page.