Skip to content

Prod deps update #40

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

Merged
merged 3 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin/all',
'plugin:prettier/recommended',
Expand Down Expand Up @@ -59,4 +58,5 @@ module.exports = {
},
},
},
ignorePatterns: ['.eslintrc.js'],
}
47 changes: 22 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,54 +38,51 @@
"test": "yarn jest --watch",
"coverage": "yarn test --coverage --watchAll=false",
"coverage-preview": "http-server -o -p 5000 coverage/lcov-report",
"type-check": "tsc --noEmit --skipLibCheck",
"verify": "yarn type-check && yarn lint && yarn build && yarn coverage"
"typecheck": "tsc --noEmit --skipLibCheck",
"verify": "yarn typecheck && yarn lint && yarn build && yarn coverage"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^2.32.0",
"json-schema": "^0.2.5",
"@typescript-eslint/experimental-utils": "^4.29.2",
"json-schema": "^0.3.0",
"natural-compare-lite": "^1.4.0"
},
"devDependencies": {
"@babel/cli": "~7.8.4",
"@babel/core": "~7.9.6",
"@babel/preset-env": "~7.9.6",
"@babel/preset-typescript": "~7.9.0",
"@babel/cli": "~7.14.8",
"@babel/core": "~7.15.0",
"@babel/preset-env": "~7.15.0",
"@babel/preset-typescript": "~7.15.0",
"@infctr/eslint-docs": "~0.4.0",
"@rollup/plugin-commonjs": "~12.0.0",
"@rollup/plugin-json": "~4.0.3",
"@rollup/plugin-node-resolve": "~8.0.0",
"@rollup/plugin-typescript": "~4.1.2",
"@types/babel__core": "~7.1.7",
"@types/babel__preset-env": "~7.9.0",
"@types/eslint": "~6.8.1",
"@types/eslint-plugin-prettier": "~3.1.0",
"@types/http-server": "~0.10.0",
"@types/eslint": "~7.28.0",
"@types/jest": "~25.2.3",
"@types/natural-compare-lite": "~1.4.0",
"@types/prettier": "~2.0.0",
"@types/rimraf": "~3.0.0",
"@types/tmp": "~0.2.0",
"@typescript-eslint/eslint-plugin": "~3.5.0",
"@typescript-eslint/parser": "~3.5.0",
"@types/rimraf": "~3.0.1",
"@types/tmp": "~0.2.1",
"@typescript-eslint/eslint-plugin": "~4.29.2",
"@typescript-eslint/parser": "~4.29.2",
"babel-jest": "~26.6.3",
"babel-plugin-module-resolver": "~4.1.0",
"eslint": "~7.23.0",
"eslint-config-prettier": "~8.1.0",
"eslint-plugin-eslint-plugin": "~2.3.0",
"eslint-plugin-import": "~2.22.1",
"eslint-plugin-jest": "~24.3.2",
"eslint-plugin-prettier": "~3.3.1",
"http-server": "~0.12.3",
"eslint": "~7.32.0",
"eslint-config-prettier": "~8.3.0",
"eslint-plugin-eslint-plugin": "~3.5.3",
"eslint-plugin-import": "~2.24.0",
"eslint-plugin-jest": "~24.4.0",
"eslint-plugin-prettier": "~3.4.0",
"http-server": "~13.0.0",
"husky": "~4.2.5",
"jest": "~26.6.3",
"lint-staged": "~10.5.4",
"prettier": "~2.2.1",
"prettier": "~2.3.2",
"rimraf": "~3.0.2",
"rollup": "~2.10.5",
"tmp": "~0.2.1",
"tsconfig": "~7.0.0",
"typescript": "~3.9.3"
"typescript": "~4.3.5"
},
"peerDependencies": {
"@typescript-eslint/parser": "^1 || ^2 || ^3 || ^4",
Expand Down
4 changes: 2 additions & 2 deletions src/config/recommended.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
plugins: ['typescript-sort-keys'],
rules: {
'typescript-sort-keys/interface': 'error',
'typescript-sort-keys/string-enum': 'error',
'typescript-sort-keys/interface': 'error' as const,
'typescript-sort-keys/string-enum': 'error' as const,
},
}
38 changes: 18 additions & 20 deletions src/utils/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,26 @@ const ascendingInsensitiveNatural = (a: string, b: string) => {
/**
* Functions which check that the given 2 names are in specific order.
*/
export const compareFn = (
isAscending: boolean,
isInsensitive: boolean,
isNatural: boolean,
) => (...args: [string?, string?]) => {
if (args.filter(Boolean).length !== 2) {
return 0
}
export const compareFn =
(isAscending: boolean, isInsensitive: boolean, isNatural: boolean) =>
(...args: [string?, string?]) => {
if (args.filter(Boolean).length !== 2) {
return 0
}

const input = (isAscending ? args : args.reverse()) as [string, string]
const input = (isAscending ? args : args.reverse()) as [string, string]

if (isInsensitive && isNatural) {
return ascendingInsensitiveNatural(...input)
}
if (isInsensitive && isNatural) {
return ascendingInsensitiveNatural(...input)
}

if (!isInsensitive && isNatural) {
return ascendingNatural(...input)
}
if (!isInsensitive && isNatural) {
return ascendingNatural(...input)
}

if (isInsensitive && !isNatural) {
return ascendingInsensitive(...input)
}
if (isInsensitive && !isNatural) {
return ascendingInsensitive(...input)
}

return ascending(...input)
}
return ascending(...input)
}
7 changes: 4 additions & 3 deletions src/utils/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ function createNodeSwapper(context: UtilRuleContext<string, RuleOptions>) {

export function createReporter<MessageIds extends string>(
context: UtilRuleContext<MessageIds, RuleOptions>,
createReportObject: (
node: TSESTree.Node,
) => { readonly loc: TSESTree.SourceLocation; readonly messageId: MessageIds },
createReportObject: (node: TSESTree.Node) => {
readonly loc: TSESTree.SourceLocation
readonly messageId: MessageIds
},
) {
// Parse options.
const order = context.options[0] || SortingOrder.Ascending
Expand Down
20 changes: 6 additions & 14 deletions tests/autofix.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import path from 'path'
import fs from 'fs'
import tmp from 'tmp'
import { ESLint } from 'eslint'
import { ESLint, Linter } from 'eslint'

import plugin from '../src'
import recommended from 'config/recommended'
import { SortingOrder } from 'common/options'
import { typescript } from './helpers/configs'

declare module 'eslint' {
export class ESLint {
constructor(config?: any)

lintFiles(path: string | string[]): Promise<any>
static outputFixes(config: any): Promise<void>
}
}

describe('autofix', () => {
beforeEach(() => {
tmp.setGracefulCleanup()
Expand All @@ -25,14 +17,14 @@ describe('autofix', () => {
[recommended, 'autofix.output.ts'],
[
{
...recommended,
plugins: recommended.plugins,
rules: {
...recommended.rules,
'typescript-sort-keys/interface': [
'error',
'asc',
'error' as const,
SortingOrder.Ascending,
{ caseSensitive: true, natural: true, requiredFirst: true },
],
] as Linter.RuleEntry,
},
},
'requiredFirst.output.ts',
Expand Down
2 changes: 1 addition & 1 deletion tests/rules/interface.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@ const invalid: readonly InvalidTestCase<Options>[] = [
describe('TypeScript', () => {
const ruleTester = new RuleTester(typescript)

ruleTester.run(name, (rule as unknown) as Rule.RuleModule, {
ruleTester.run(name, rule as unknown as Rule.RuleModule, {
valid: processValidTestCase(valid),
invalid: processInvalidTestCase(invalid),
})
Expand Down
2 changes: 1 addition & 1 deletion tests/rules/string-enum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ const invalid: readonly InvalidTestCase<Options>[] = [
describe('TypeScript', () => {
const ruleTester = new RuleTester(typescript)

ruleTester.run(name, (rule as unknown) as Rule.RuleModule, {
ruleTester.run(name, rule as unknown as Rule.RuleModule, {
valid: processValidTestCase(valid),
invalid: processInvalidTestCase(invalid),
})
Expand Down
Loading