Skip to content

Commit

Permalink
chore: fix lint, experimental-utils -> utils, laxxer requirements, ad…
Browse files Browse the repository at this point in the history
…d changeset
  • Loading branch information
roikoren755 committed Mar 22, 2022
2 parents 5ef380a + 166fb35 commit 69bad2d
Show file tree
Hide file tree
Showing 92 changed files with 301 additions and 290 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-starfishes-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-node-roikoren': patch
---

chore(deps): update typescript-eslint monorepo to v5.16.0
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ module.exports = {
},
overrides: [
{ files: ['./.eslintrc.js', './.prettierrc.js', './commitlint.config.js'], rules: { 'no-undef': OFF } },
{
files: ['./.eslintrc.js', './src/index.ts', './src/configs/*.ts'],
rules: { '@typescript-eslint/naming-convention': OFF },
},
{
files: [
'./src/configs/recommended*.ts',
Expand Down
348 changes: 163 additions & 185 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"prettier": "2.5.1"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "5.15.0",
"@typescript-eslint/utils": "^5.0.0",
"eslint-plugin-es-roikoren": "2.0.0",
"ignore": "^5.2.0",
"is-core-module": "^2.8.0",
Expand All @@ -56,10 +56,11 @@
"@types/mocha": "9.1.0",
"@types/resolve": "1.20.1",
"@types/semver": "7.3.9",
"@typescript-eslint/eslint-plugin": "5.15.0",
"@typescript-eslint/parser": "5.15.0",
"@typescript-eslint/types": "5.15.0",
"@typescript-eslint/typescript-estree": "5.15.0",
"@typescript-eslint/eslint-plugin": "5.16.0",
"@typescript-eslint/parser": "5.16.0",
"@typescript-eslint/types": "5.16.0",
"@typescript-eslint/typescript-estree": "5.16.0",
"@typescript-eslint/utils": "5.16.0",
"camelcase": "6.3.0",
"eslint": "8.11.0",
"eslint-config-prettier": "8.5.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/new-rule.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { writeFileSync } from 'fs';
import path from 'path';

import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';

// main
const run = async (ruleId: string): Promise<void> => {
Expand Down Expand Up @@ -44,8 +44,8 @@ export default createRule({
);
writeFileSync(
testFile,
`import { TSESLint } from '@typescript-eslint/experimental-utils';
import { AST_NODE_TYPES } from '@typescript-eslint/types';
`import { AST_NODE_TYPES } from '@typescript-eslint/types';
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../../../src/rules/${ruleId}';
Expand Down
2 changes: 1 addition & 1 deletion scripts/rules.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';

import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';
import glob from 'fast-glob';

const rootDir = path.resolve(__dirname, '../src/rules/');
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-src-index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { writeFileSync } from 'fs';
import path from 'path';

import { TSESLint } from '@typescript-eslint/experimental-utils';
import { TSESLint } from '@typescript-eslint/utils';
import camelcase from 'camelcase';

import { rules } from './rules';
Expand All @@ -28,7 +28,7 @@ const deprecatedRulesUsage =
: '';

const rawContent = `/* DON'T EDIT THIS FILE. This is generated by 'scripts/update-src-index.ts' */
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';
import recommendedModule from './configs/recommended-module';
import recommendedScript from './configs/recommended-script';
Expand Down
2 changes: 1 addition & 1 deletion src/configs/commons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

export const commonGlobals: NonNullable<TSESLint.Linter.Config['globals']> = {
// ECMAScript
Expand Down
3 changes: 1 addition & 2 deletions src/configs/recommended-module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { commonGlobals, commonRules } from './commons';

const recommendedModule: TSESLint.Linter.Config = {
// eslint-disable-next-line @typescript-eslint/naming-convention
globals: { ...commonGlobals, __dirname: 'off', __filename: 'off', exports: 'off', module: 'off', require: 'off' },
parserOptions: { ecmaFeatures: { globalReturn: false }, ecmaVersion: 2019, sourceType: 'module' },
plugins: ['node-roikoren'],
Expand Down
4 changes: 1 addition & 3 deletions src/configs/recommended-script.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { commonGlobals, commonRules } from './commons';

const recommendedScript: TSESLint.Linter.Config = {
globals: {
...commonGlobals,
// eslint-disable-next-line @typescript-eslint/naming-convention
__dirname: 'readonly',
// eslint-disable-next-line @typescript-eslint/naming-convention
__filename: 'readonly',
exports: 'writable',
module: 'readonly',
Expand Down
2 changes: 1 addition & 1 deletion src/configs/recommended.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { getPackageJson } from '../util/get-package-json';

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DON'T EDIT THIS FILE. This is generated by 'scripts/update-src-index.ts' */
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import recommended from './configs/recommended';
import recommendedModule from './configs/recommended-module';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/exports-style.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-lines */
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import type { TSESLint } from '@typescript-eslint/utils';

import { createRule } from '../util/create-rule';

Expand Down
4 changes: 3 additions & 1 deletion src/rules/file-extension-in-import.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readdirSync } from 'fs';
import path from 'path';

import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { createRule } from '../util/create-rule';
import { schema } from '../util/get-try-extensions';
Expand All @@ -13,9 +13,11 @@ const packageNamePattern = /^(?:@[^/\\]+[/\\])?[^/\\]+$/u;
const corePackageOverridePattern =
/^(?:assert|async_hooks|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|http2|https|inspector|module|net|os|path|perf_hooks|process|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|trace_events|tty|url|util|v8|vm|worker_threads|zlib)[/\\]$/u;
const typescriptFileExtensionMapping = {
/* eslint-disable @typescript-eslint/naming-convention */
'.cts': '.cjs',
'.mts': '.mjs',
'.ts': '.js',
/* eslint-enable @typescript-eslint/naming-convention */
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/rules/global-require.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import type { TSESLint } from '@typescript-eslint/utils';

import { createRule } from '../util/create-rule';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/handle-callback-err.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import type { TSESLint } from '@typescript-eslint/utils';

import { createRule } from '../util/create-rule';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-deprecated-api/globals.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import type { DeprecatedMap } from '../../util/enumerate-property-names';

Expand Down
3 changes: 2 additions & 1 deletion src/rules/no-deprecated-api/modules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable max-lines */
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import type { DeprecatedMap } from '../../util/enumerate-property-names';

Expand Down Expand Up @@ -197,6 +197,7 @@ export const modules: DeprecatedMap = {
},
// safe-buffer.Buffer function/constructror is just a re-export of buffer.Buffer
// and should be deprecated likewise.
// eslint-disable-next-line @typescript-eslint/naming-convention
'safe-buffer': {
Buffer: {
[ASTUtils.ReferenceTracker.CONSTRUCT]: {
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-deprecated-api/no-deprecated-api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import { ASTUtils } from '@typescript-eslint/utils';
import type { TSESLint } from '@typescript-eslint/utils';
import type { Range } from 'semver';

import { createRule } from '../../util/create-rule';
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-exports-assign.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import type { TSESLint } from '@typescript-eslint/utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { createRule } from '../util/create-rule';

Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-path-concat.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'path';

import { ASTUtils } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import { ASTUtils } from '@typescript-eslint/utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { createRule } from '../util/create-rule';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unsupported-features/es-builtins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkUnsupportedBuiltins } from '../../util/check-unsupported-builtins';
import type { IRawOptions, SupportMap } from '../../util/check-unsupported-builtins';
Expand Down
7 changes: 5 additions & 2 deletions src/rules/no-unsupported-features/es-syntax.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-lines */
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESTree } from '@typescript-eslint/typescript-estree';
import { ASTUtils } from '@typescript-eslint/utils';
import type { TSESLint } from '@typescript-eslint/utils';
import eslintPluginEs from 'eslint-plugin-es-roikoren';
import { Range } from 'semver';

Expand Down Expand Up @@ -66,6 +66,7 @@ const features: Record<string, { ruleId: keyof typeof eslintPluginEs['rules']; c
forOfLoops: { ruleId: 'no-for-of-loops', cases: [{ supported: '0.12.0', messageId: 'no-for-of-loops' }] },
generators: { ruleId: 'no-generators', cases: [{ supported: '4.0.0', messageId: 'no-generators' }] },
modules: { ruleId: 'no-modules', cases: [{ supported: '13.2.0', messageId: 'no-modules' }] },
// eslint-disable-next-line @typescript-eslint/naming-convention
'new.target': { ruleId: 'no-new-target', cases: [{ supported: '5.0.0', messageId: 'no-new-target' }] },
objectSuperProperties: {
ruleId: 'no-object-super-properties',
Expand Down Expand Up @@ -331,6 +332,7 @@ export default createRule<[options: IRawOptions], string>({
// ------------------------------------------------------------------
// ES2015
// ------------------------------------------------------------------
/* eslint-disable @typescript-eslint/naming-convention */
'no-arrow-functions': getMessage('Arrow functions'),
'no-binary-numeric-literals': getMessage('Binary numeric literals'),
'no-block-scoped-functions-strict': getMessage('Block-scoped functions in strict mode'),
Expand Down Expand Up @@ -399,6 +401,7 @@ export default createRule<[options: IRawOptions], string>({
// ------------------------------------------------------------------
'no-logical-assignment-operators': getMessage('Logical assignment operators'),
'no-numeric-separators': getMessage('Numeric separators'),
/* eslint-enable @typescript-eslint/naming-convention */
},
},
defaultOptions: [{}],
Expand Down
3 changes: 2 additions & 1 deletion src/rules/no-unsupported-features/node-builtins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import type { IRawOptions } from '../../util/check-unsupported-builtins';
import { checkUnsupportedBuiltins } from '../../util/check-unsupported-builtins';
Expand Down Expand Up @@ -121,6 +121,7 @@ const modules = {
Dir: { [ASTUtils.ReferenceTracker.READ]: { supported: '12.12.0' } },
StatWatcher: { [ASTUtils.ReferenceTracker.READ]: { supported: '14.3.0', backported: ['12.20.0'] } },
},
// eslint-disable-next-line @typescript-eslint/naming-convention
'fs/promises': { [ASTUtils.ReferenceTracker.READ]: { supported: '14.0.0' } },
http2: { [ASTUtils.ReferenceTracker.READ]: { supported: '10.10.0', backported: ['8.13.0'], experimental: '8.4.0' } },
inspector: { [ASTUtils.ReferenceTracker.READ]: { supported: '14.18.0', experimental: '8.0.0' } },
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-global/buffer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkForPreferGlobal, defaultOptions, schema } from '../../util/check-prefer-global';
import type { MessageIds, Options } from '../../util/check-prefer-global';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-global/console.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkForPreferGlobal, defaultOptions, schema } from '../../util/check-prefer-global';
import type { MessageIds, Options } from '../../util/check-prefer-global';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-global/process.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkForPreferGlobal, defaultOptions, schema } from '../../util/check-prefer-global';
import type { MessageIds, Options } from '../../util/check-prefer-global';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-global/text-decoder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkForPreferGlobal, defaultOptions, schema } from '../../util/check-prefer-global';
import type { MessageIds, Options } from '../../util/check-prefer-global';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-global/text-encoder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkForPreferGlobal, defaultOptions, schema } from '../../util/check-prefer-global';
import type { MessageIds, Options } from '../../util/check-prefer-global';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-global/url-search-params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkForPreferGlobal, defaultOptions, schema } from '../../util/check-prefer-global';
import type { MessageIds, Options } from '../../util/check-prefer-global';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-global/url.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { checkForPreferGlobal, defaultOptions, schema } from '../../util/check-prefer-global';
import type { MessageIds, Options } from '../../util/check-prefer-global';
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-promises/dns.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { createRule } from '../../util/create-rule';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-promises/fs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

import { createRule } from '../../util/create-rule';

Expand Down
2 changes: 1 addition & 1 deletion src/rules/shebang.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';

import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { createRule } from '../util/create-rule';
import { schema as convertPathSchema, getConvertPath } from '../util/get-convert-path';
Expand Down
2 changes: 1 addition & 1 deletion src/util/check-existence.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { exists } from './exists';
import { getAllowModules } from './get-allow-modules';
Expand Down
2 changes: 1 addition & 1 deletion src/util/check-extraneous.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';

import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { getAllowModules } from './get-allow-modules';
import { getPackageJson } from './get-package-json';
Expand Down
4 changes: 2 additions & 2 deletions src/util/check-prefer-global.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';
import type { TSESLint } from '@typescript-eslint/utils';

export type MessageIds = 'preferGlobal' | 'preferModule';
export type Options = ['always' | 'never'];
Expand Down
2 changes: 1 addition & 1 deletion src/util/check-publish.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';

import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';

import { getAllowModules } from './get-allow-modules';
import { getConvertPath } from './get-convert-path';
Expand Down
2 changes: 1 addition & 1 deletion src/util/check-restricted.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';

import type { TSESLint } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/utils';
import { Minimatch } from 'minimatch';
import type { IMinimatch } from 'minimatch';

Expand Down
4 changes: 2 additions & 2 deletions src/util/check-unsupported-builtins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import type { TSESLint } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';
import type { TSESLint } from '@typescript-eslint/utils';
import { lt, major } from 'semver';
import type { Range } from 'semver';

Expand Down
2 changes: 1 addition & 1 deletion src/util/create-rule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ESLintUtils } from '@typescript-eslint/experimental-utils';
import { ESLintUtils } from '@typescript-eslint/utils';

export const createRule = ESLintUtils.RuleCreator(
(name) => `https://github.com/roikoren755/eslint-plugin-node/docs/rules/${name}.md`,
Expand Down
2 changes: 1 addition & 1 deletion src/util/enumerate-property-names.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ASTUtils } from '@typescript-eslint/experimental-utils';
import { ASTUtils } from '@typescript-eslint/utils';

export interface IDeprecated {
since: string;
Expand Down

0 comments on commit 69bad2d

Please sign in to comment.