Skip to content
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

feat: upgrade to typescript-eslint v8 #74

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
55 changes: 28 additions & 27 deletions lib/rules/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ module.exports = {
}],

'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': [
'error',
{
types: {
'{}': false,
object: false,
},
extendDefaults: true,
},
],
'@typescript-eslint/no-empty-object-type': 'off',
// '@typescript-eslint/ban-types': [
// 'error',
// {
// types: {
// '{}': false,
// object: false,
// },
// extendDefaults: true,
// },
// ],

/**
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.mdx
*/
semi: 'off',
'@typescript-eslint/semi': [ 'error' ],
// '@typescript-eslint/semi': [ 'error' ],

/**
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.mdx
Expand Down Expand Up @@ -81,22 +82,22 @@ module.exports = {
*/
'@typescript-eslint/explicit-member-accessibility': 'off',

// https://github.com/typescript-eslint/typescript-eslint/issues/1824#issuecomment-957559729
// ignore
indent: 'off',

/**
* Enforce consistent indentation (`indent` from TSLint)
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.mdx
*/
'@typescript-eslint/indent': [ 'error', 2, {
SwitchCase: 1,
ignoredNodes: [
'FunctionExpression > .params[decorators.length > 0]',
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key',
],
}],
// // https://github.com/typescript-eslint/typescript-eslint/issues/1824#issuecomment-957559729
// // ignore
// indent: 'off',

// /**
// * Enforce consistent indentation (`indent` from TSLint)
// * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.mdx
// */
// '@typescript-eslint/indent': [ 'error', 2, {
// SwitchCase: 1,
// ignoredNodes: [
// 'FunctionExpression > .params[decorators.length > 0]',
// 'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
// 'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key',
// ],
// }],

/**
* Require that interface names be prefixed with `I` (`interface-name` from TSLint)
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
"lib"
],
"dependencies": {
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"eslint-plugin-eggache": "^2.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^46.9.1",
"eslint-plugin-node": "^11.1.0"
},
"devDependencies": {
"coffee": "^5.4.0",
"egg-bin": "6",
"eslint": "^8.3.0",
"typescript": "^5.2.2"
"coffee": "5",
"@eggjs/bin": "7",
"eslint": "8",
"typescript": "5"
},
"repository": {
"type": "git",
Expand All @@ -36,7 +36,6 @@
"scripts": {
"lint": "eslint test/*.test.js lib *.js --fix",
"test": "egg-bin test --ts false",
"ci": "npm run lint && egg-bin cov",
"contributor": "git-contributor"
"ci": "npm run lint && egg-bin cov"
}
}
4 changes: 2 additions & 2 deletions test/enforce-node-prefix.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ describe('test/enforce-node-prefix.test.js', () => {
describe('normal', () => {
it('should works without error', async () => {
await coffee.spawn('eslint', [ 'correct.ts' ], { cwd })
// .debug()
.debug()
.expect('code', 0)
.end();
await coffee.spawn('eslint', [ 'correct.js' ], { cwd: cwdJS })
// .debug()
.debug()
.expect('code', 0)
.end();
});
Expand Down
6 changes: 3 additions & 3 deletions test/ts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
});
});

describe('semicolon', () => {
describe.only('semicolon', () => {

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

describe.only not permitted

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

describe.only not permitted

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

describe.only not permitted

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)

describe.only not permitted

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

describe.only not permitted

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

describe.only not permitted

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

describe.only not permitted

Check warning on line 42 in test/ts.test.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

describe.only not permitted
it('should success with semicolon', () => {
return coffee.spawn('eslint', [ './semi/semi.ts' ], { cwd })
// .debug()
.debug()
.expect('code', 0)
.end();
});

it('should fail without semicolon', () => {
return coffee.spawn('eslint', [ './semi/semi-error.ts' ], { cwd })
// .debug()
.debug()
.expect('stdout', /Missing semicolon/)
.expect('code', 1)
.end();
Expand Down
Loading