From f2b7cd8c9cc2ccd5bf5cbb4d32676f585cbe2afb Mon Sep 17 00:00:00 2001 From: roikoren755 Date: Fri, 19 Nov 2021 15:47:07 +0200 Subject: [PATCH] chore: updates and fixes --- README.md | 3 +-- package.json | 2 +- scripts/rules.ts | 6 ++---- scripts/update-src-configs.ts | 6 +++++- src/configs/no-new-in-es2015.ts | 6 +++++- src/configs/no-new-in-es2016.ts | 6 +++++- src/configs/no-new-in-es2017.ts | 6 +++++- src/configs/no-new-in-es2018.ts | 6 +++++- src/configs/no-new-in-es2019.ts | 6 +++++- src/configs/no-new-in-es2020.ts | 6 +++++- src/configs/no-new-in-es2021.ts | 6 +++++- src/configs/no-new-in-es5.ts | 6 +++++- src/configs/no-new-in-esnext.ts | 6 +++++- src/configs/restrict-to-es2015.ts | 6 +++++- src/configs/restrict-to-es2016.ts | 6 +++++- src/configs/restrict-to-es2017.ts | 6 +++++- src/configs/restrict-to-es2018.ts | 6 +++++- src/configs/restrict-to-es2019.ts | 8 +++++++- src/configs/restrict-to-es2020.ts | 6 +++++- src/configs/restrict-to-es3.ts | 6 +++++- src/configs/restrict-to-es5.ts | 6 +++++- src/configs/typescript.ts | 6 +++++- tsconfig.json | 3 ++- 23 files changed, 103 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 18a91de6..2d334999 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,9 @@ yarn add -D eslint eslint-plugin-es-roikoren If you installed `eslint` globally, you should install this plugin in the same way. -::: tip Requirements +**Requirements** - Node.js `12.22.0` or newer. - ESLint `5.16.0` or newer. - ::: ## 📖 Usage diff --git a/package.json b/package.json index 7406b123..600ac081 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "prerelease": "yarn build", "release": "changeset publish", "test": "nyc mocha tests/**/*.ts --reporter dot", - "type": "tsc --noEmit --noImplicitAny", + "type": "tsc", "update": "yarn update:configs && yarn update:index && yarn update:doc && yarn update:ruledocs", "update:configs": "ts-node scripts/update-src-configs", "update:doc": "ts-node scripts/update-docs-readme", diff --git a/scripts/rules.ts b/scripts/rules.ts index 1a82fb25..d27b8e01 100644 --- a/scripts/rules.ts +++ b/scripts/rules.ts @@ -18,7 +18,7 @@ export interface ICategory { experimental?: boolean; } -const categories = [13, 12, 11, 10, 9, 8, 7, 6, 5].reduce>( +export const categories = [13, 12, 11, 10, 9, 8, 7, 6, 5].reduce>( (map, revision, _, [latest]) => { const year = revision <= 5 ? 5 : 2009 + revision; const id = `ES${year}`; @@ -30,7 +30,7 @@ const categories = [13, 12, 11, 10, 9, 8, 7, 6, 5].reduce `/** * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default ${code}; +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = ${code}; + +export default config; `; const run = async (): Promise => { diff --git a/src/configs/no-new-in-es2015.ts b/src/configs/no-new-in-es2015.ts index 5cb5fbe0..d69f729b 100644 --- a/src/configs/no-new-in-es2015.ts +++ b/src/configs/no-new-in-es2015.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-array-from': 'error', @@ -86,3 +88,5 @@ export default { 'es-roikoren/no-weak-set': 'error', }, }; + +export default config; diff --git a/src/configs/no-new-in-es2016.ts b/src/configs/no-new-in-es2016.ts index 1acdb34c..1b8b0eee 100644 --- a/src/configs/no-new-in-es2016.ts +++ b/src/configs/no-new-in-es2016.ts @@ -2,7 +2,11 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-array-prototype-includes': 'error', 'es-roikoren/no-exponential-operators': 'error' }, }; + +export default config; diff --git a/src/configs/no-new-in-es2017.ts b/src/configs/no-new-in-es2017.ts index 7e93e7c8..665ca9d5 100644 --- a/src/configs/no-new-in-es2017.ts +++ b/src/configs/no-new-in-es2017.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-async-functions': 'error', @@ -15,3 +17,5 @@ export default { 'es-roikoren/no-trailing-function-commas': 'error', }, }; + +export default config; diff --git a/src/configs/no-new-in-es2018.ts b/src/configs/no-new-in-es2018.ts index 617a25c3..a760a742 100644 --- a/src/configs/no-new-in-es2018.ts +++ b/src/configs/no-new-in-es2018.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-async-iteration': 'error', @@ -15,3 +17,5 @@ export default { 'es-roikoren/no-rest-spread-properties': 'error', }, }; + +export default config; diff --git a/src/configs/no-new-in-es2019.ts b/src/configs/no-new-in-es2019.ts index 0f56a183..542ee1dc 100644 --- a/src/configs/no-new-in-es2019.ts +++ b/src/configs/no-new-in-es2019.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-array-prototype-flat': 'error', @@ -14,3 +16,5 @@ export default { 'es-roikoren/no-symbol-prototype-description': 'error', }, }; + +export default config; diff --git a/src/configs/no-new-in-es2020.ts b/src/configs/no-new-in-es2020.ts index b42f2e32..44d0a66c 100644 --- a/src/configs/no-new-in-es2020.ts +++ b/src/configs/no-new-in-es2020.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-bigint': 'error', @@ -16,3 +18,5 @@ export default { 'es-roikoren/no-string-prototype-matchall': 'error', }, }; + +export default config; diff --git a/src/configs/no-new-in-es2021.ts b/src/configs/no-new-in-es2021.ts index df6a9f1a..165db59c 100644 --- a/src/configs/no-new-in-es2021.ts +++ b/src/configs/no-new-in-es2021.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-logical-assignment-operators': 'error', @@ -12,3 +14,5 @@ export default { 'es-roikoren/no-weakrefs': 'error', }, }; + +export default config; diff --git a/src/configs/no-new-in-es5.ts b/src/configs/no-new-in-es5.ts index 9b2ae356..140c9079 100644 --- a/src/configs/no-new-in-es5.ts +++ b/src/configs/no-new-in-es5.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-accessor-properties': 'error', @@ -37,3 +39,5 @@ export default { 'es-roikoren/no-trailing-commas': 'error', }, }; + +export default config; diff --git a/src/configs/no-new-in-esnext.ts b/src/configs/no-new-in-esnext.ts index 5f691300..d98f0d08 100644 --- a/src/configs/no-new-in-esnext.ts +++ b/src/configs/no-new-in-esnext.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-array-string-prototype-at': 'error', @@ -12,3 +14,5 @@ export default { 'es-roikoren/no-regexp-d-flag': 'error', }, }; + +export default config; diff --git a/src/configs/restrict-to-es2015.ts b/src/configs/restrict-to-es2015.ts index 86eaa993..076bfd6a 100644 --- a/src/configs/restrict-to-es2015.ts +++ b/src/configs/restrict-to-es2015.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { extends: [ require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020'), @@ -12,3 +14,5 @@ export default { require.resolve('./no-new-in-es2016'), ], }; + +export default config; diff --git a/src/configs/restrict-to-es2016.ts b/src/configs/restrict-to-es2016.ts index edc06ef4..f9df139d 100644 --- a/src/configs/restrict-to-es2016.ts +++ b/src/configs/restrict-to-es2016.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { extends: [ require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020'), @@ -11,3 +13,5 @@ export default { require.resolve('./no-new-in-es2017'), ], }; + +export default config; diff --git a/src/configs/restrict-to-es2017.ts b/src/configs/restrict-to-es2017.ts index 01714708..51fd41cf 100644 --- a/src/configs/restrict-to-es2017.ts +++ b/src/configs/restrict-to-es2017.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { extends: [ require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020'), @@ -10,3 +12,5 @@ export default { require.resolve('./no-new-in-es2018'), ], }; + +export default config; diff --git a/src/configs/restrict-to-es2018.ts b/src/configs/restrict-to-es2018.ts index 582cd658..e4cc826c 100644 --- a/src/configs/restrict-to-es2018.ts +++ b/src/configs/restrict-to-es2018.ts @@ -2,10 +2,14 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { extends: [ require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020'), require.resolve('./no-new-in-es2019'), ], }; + +export default config; diff --git a/src/configs/restrict-to-es2019.ts b/src/configs/restrict-to-es2019.ts index 83f97acc..9c255900 100644 --- a/src/configs/restrict-to-es2019.ts +++ b/src/configs/restrict-to-es2019.ts @@ -2,4 +2,10 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { extends: [require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020')] }; +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { + extends: [require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020')], +}; + +export default config; diff --git a/src/configs/restrict-to-es2020.ts b/src/configs/restrict-to-es2020.ts index a0a7575f..0100260c 100644 --- a/src/configs/restrict-to-es2020.ts +++ b/src/configs/restrict-to-es2020.ts @@ -2,4 +2,8 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { extends: [require.resolve('./no-new-in-es2021')] }; +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { extends: [require.resolve('./no-new-in-es2021')] }; + +export default config; diff --git a/src/configs/restrict-to-es3.ts b/src/configs/restrict-to-es3.ts index d3e15699..17b8dc3e 100644 --- a/src/configs/restrict-to-es3.ts +++ b/src/configs/restrict-to-es3.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { extends: [ require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020'), @@ -14,3 +16,5 @@ export default { require.resolve('./no-new-in-es5'), ], }; + +export default config; diff --git a/src/configs/restrict-to-es5.ts b/src/configs/restrict-to-es5.ts index 49a08b9d..2d80377b 100644 --- a/src/configs/restrict-to-es5.ts +++ b/src/configs/restrict-to-es5.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { extends: [ require.resolve('./no-new-in-es2021'), require.resolve('./no-new-in-es2020'), @@ -13,3 +15,5 @@ export default { require.resolve('./no-new-in-es2015'), ], }; + +export default config; diff --git a/src/configs/typescript.ts b/src/configs/typescript.ts index 5b3f2633..ec63ebc7 100644 --- a/src/configs/typescript.ts +++ b/src/configs/typescript.ts @@ -2,7 +2,9 @@ * DON'T EDIT THIS FILE. * This file was generated by 'scripts/update-src-configs.ts' script. */ -export default { +import type { TSESLint } from '@typescript-eslint/experimental-utils'; + +const config: TSESLint.Linter.Config = { plugins: ['es-roikoren'], rules: { 'es-roikoren/no-async-functions': 'off', @@ -14,3 +16,5 @@ export default { 'es-roikoren/no-trailing-function-commas': 'off', }, }; + +export default config; diff --git a/tsconfig.json b/tsconfig.json index a72745a5..6e5a96a8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "./tsconfig.prod.json", "compilerOptions": { - "noEmit": true + "noEmit": true, + "noImplicitAny": true }, "exclude": ["**/dist/**/*"], "include": [