Skip to content

Commit

Permalink
fix(eslint-config): remove Function from ban-types rule
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewLeedham committed Jun 9, 2020
1 parent 0e5726c commit 936f8c4
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions packages/xerox-eslint-config/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,52 @@ module.exports = {
'import/default': 'off',
'import/export': 'off',
'import/no-named-as-default-member': 'off',
'@typescript-eslint/ban-types': [
'error',
{
types: {
String: {
message: 'Use string instead',
fixWith: 'string',
},
Boolean: {
message: 'Use boolean instead',
fixWith: 'boolean',
},
Number: {
message: 'Use number instead',
fixWith: 'number',
},
Symbol: {
message: 'Use symbol instead',
fixWith: 'symbol',
},

// object typing
Object: {
message: [
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.',
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
'- If you want a type meaning "any value", you probably want `unknown` instead.',
].join('\n'),
},
'{}': {
message: [
'`{}` actually means "any non-nullish value".',
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
'- If you want a type meaning "any value", you probably want `unknown` instead.',
].join('\n'),
},
object: {
message: [
'The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).',
'Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys.',
].join('\n'),
},
},
extendDefaults: false,
},
],
},
overrides: [
{
Expand Down

0 comments on commit 936f8c4

Please sign in to comment.