Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mightyiam/eslint-config-love
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v29.0.0
Choose a base ref
...
head repository: mightyiam/eslint-config-love
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v30.0.0
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Jan 17, 2023

  1. feat: @typescript-eslint/ban-types

    BREAKING CHANGE: @typescript-eslint/ban-types
    mightyiam committed Jan 17, 2023
    Copy the full SHA
    94fcc73 View commit details
  2. Merge pull request #1039 from standard/ban-types

    feat: @typescript-eslint/ban-types
    mightyiam authored Jan 17, 2023
    Copy the full SHA
    343eb1c View commit details
  3. chore(release): 30.0.0 [skip ci]

    ## [30.0.0](v29.0.0...v30.0.0) (2023-01-17)
    
    ### ⚠ BREAKING CHANGES
    
    * @typescript-eslint/ban-types
    
    ### Features
    
    * @typescript-eslint/ban-types ([94fcc73](94fcc73))
    semantic-release-bot committed Jan 17, 2023
    Copy the full SHA
    4c76a6b View commit details
Showing with 108 additions and 2 deletions.
  1. +11 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +48 −1 src/index.test.ts
  4. +48 −0 src/index.ts
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## [30.0.0](https://github.com/standard/eslint-config-standard-with-typescript/compare/v29.0.0...v30.0.0) (2023-01-17)


### ⚠ BREAKING CHANGES

* @typescript-eslint/ban-types

### Features

* @typescript-eslint/ban-types ([94fcc73](https://github.com/standard/eslint-config-standard-with-typescript/commit/94fcc736c0fac1b7aba743310cb5f1ee382d8d3f))

## [29.0.0](https://github.com/standard/eslint-config-standard-with-typescript/compare/v28.0.0...v29.0.0) (2023-01-17)


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-standard-with-typescript",
"version": "29.0.0",
"version": "30.0.0",
"description": "An ESLint Shareable Config for JavaScript Standard Style with TypeScript support",
"main": "lib/index.js",
"scripts": {
49 changes: 48 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
@@ -92,6 +92,54 @@ test('export', (t): void => {
minimumDescriptionLength: 3
}],
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/ban-types': ['error', {
extendDefaults: false,
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'
},
BigInt: {
message: 'Use bigint instead',
fixWith: 'bigint'
},
Function: {
message: [
'The `Function` type accepts any function-like value.',
'It provides no type safety when calling the function, which can be a common source of bugs.',
'It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.',
'If you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
].join('\n')
},
// 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')
}
}
}],
'@typescript-eslint/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@typescript-eslint/comma-dangle': ['error', {
arrays: 'never',
@@ -371,7 +419,6 @@ test('all plugin rules are considered', (t) => {
// This serves as a todo list and should ideally eventually end up empty
// and then fail upon plugin upgrades where new rules are released.
const notYetConsideredRules: string[] = [
'ban-types',
'class-literal-property-style',
'consistent-generic-constructors',
'consistent-type-exports',
48 changes: 48 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -81,6 +81,54 @@ const config: Linter.Config = {
minimumDescriptionLength: 3
}],
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/ban-types': ['error', {
extendDefaults: false,
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'
},
BigInt: {
message: 'Use bigint instead',
fixWith: 'bigint'
},
Function: {
message: [
'The `Function` type accepts any function-like value.',
'It provides no type safety when calling the function, which can be a common source of bugs.',
'It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.',
'If you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
].join('\n')
},
// 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')
}
}
}],
'@typescript-eslint/comma-dangle': ['error', {
arrays: 'never',
objects: 'never',