Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-config-xo-typescript

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-xo-typescript - npm Package Compare versions

Comparing version 0.48.0 to 0.49.0

154

index.js
'use strict';
const getNamingConventionRule = ({isTsx}) => ({
"@typescript-eslint/naming-convention": [
'error',
{
// selector: ['variableLike', 'memberLike', 'property', 'method'],
// Note: Leaving out `parameter` and `typeProperty` because of the mentioned known issues.
// Note: We are intentionally leaving out `enumMember` as it's usually pascal-case or upper-snake-case.
selector: ['variable', 'function', 'classProperty', 'objectLiteralProperty', 'parameterProperty', 'classMethod', 'objectLiteralMethod', 'typeMethod', 'accessor'],
format: [
'strictCamelCase',
isTsx && 'StrictPascalCase',
].filter(Boolean),
// We allow double underscore because of GraphQL type names and some React names.
leadingUnderscore: 'allowSingleOrDouble',
trailingUnderscore: 'allow',
// Ignore `{'Retry-After': retryAfter}` type properties.
filter: {
regex: '[- ]',
match: false
}
},
{
selector: 'typeLike',
format: [
'StrictPascalCase'
]
},
{
selector: 'variable',
types: [
'boolean'
],
format: [
'StrictPascalCase'
],
prefix: [
'is',
'has',
'can',
'should',
'will',
'did'
]
},
{
// Interface name should not be prefixed with `I`.
selector: 'interface',
filter: /^(?!I)[A-Z]/.source,
format: [
'StrictPascalCase'
]
},
{
// Type parameter name should either be `T` or a descriptive name.
selector: 'typeParameter',
filter: /^T$|^[A-Z][a-zA-Z]+$/.source,
format: [
'StrictPascalCase'
]
},
// Allow these in non-camel-case when quoted.
{
selector: [
'classProperty',
'objectLiteralProperty'
],
format: null,
modifiers: [
'requiresQuotes'
]
}
]
});
module.exports = {

@@ -277,72 +352,3 @@ parser: require.resolve('@typescript-eslint/parser'),

// TODO: Prevent `_` prefix on private fields when TypeScript 3.8 is out.
'@typescript-eslint/naming-convention': [
'error',
{
// selector: ['variableLike', 'memberLike', 'property', 'method'],
// Note: Leaving out `parameter` and `typeProperty` because of the mentioned known issues.
// Note: We are intentionally leaving out `enumMember` as it's usually pascal-case or upper-snake-case.
selector: ['variable', 'function', 'classProperty', 'objectLiteralProperty', 'parameterProperty', 'classMethod', 'objectLiteralMethod', 'typeMethod', 'accessor'],
format: [
'strictCamelCase'
],
// We allow double underscope because of GraphQL type names and some React names.
leadingUnderscore: 'allowSingleOrDouble',
trailingUnderscore: 'allow',
// Ignore `{'Retry-After': retryAfter}` type properties.
filter: {
regex: '[- ]',
match: false
}
},
{
selector: 'typeLike',
format: [
'StrictPascalCase'
]
},
{
selector: 'variable',
types: [
'boolean'
],
format: [
'StrictPascalCase'
],
prefix: [
'is',
'has',
'can',
'should',
'will',
'did'
]
},
{
// Interface name should not be prefixed with `I`.
selector: 'interface',
filter: /^(?!I)[A-Z]/.source,
format: [
'StrictPascalCase'
]
},
{
// Type parameter name should either be `T` or a descriptive name.
selector: 'typeParameter',
filter: /^T$|^[A-Z][a-zA-Z]+$/.source,
format: [
'StrictPascalCase'
]
},
// Allow these in non-camel-case when quoted.
{
selector: [
'classProperty',
'objectLiteralProperty'
],
format: null,
modifiers: [
'requiresQuotes'
]
}
],
...getNamingConventionRule({isTsx: false}),
'@typescript-eslint/no-base-to-string': 'error',

@@ -678,4 +684,12 @@ 'no-array-constructor': 'off',

}
},
{
files: [
'**/*.tsx'
],
rules: {
...getNamingConventionRule({isTsx: true})
}
}
]
};
{
"name": "eslint-config-xo-typescript",
"version": "0.48.0",
"version": "0.49.0",
"description": "ESLint shareable config for TypeScript to be used with eslint-config-xo",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc