Skip to content

Commit

Permalink
chore: updates and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
roikoren755 committed Nov 19, 2021
1 parent 9ab1941 commit f2b7cd8
Show file tree
Hide file tree
Showing 23 changed files with 103 additions and 27 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions scripts/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface ICategory {
experimental?: boolean;
}

const categories = [13, 12, 11, 10, 9, 8, 7, 6, 5].reduce<Record<string, ICategory>>(
export const categories = [13, 12, 11, 10, 9, 8, 7, 6, 5].reduce<Record<string, ICategory>>(
(map, revision, _, [latest]) => {
const year = revision <= 5 ? 5 : 2009 + revision;
const id = `ES${year}`;
Expand All @@ -30,7 +30,7 @@ const categories = [13, 12, 11, 10, 9, 8, 7, 6, 5].reduce<Record<string, ICatego
{ typescript: { revision: 'typescript', rules: [] } },
);

const rules: IRule[] = [];
export const rules: IRule[] = [];

(function walk(dirPath) {
for (const entry of readdirSync(dirPath, { withFileTypes: true })) {
Expand Down Expand Up @@ -71,5 +71,3 @@ const rules: IRule[] = [];
rules.push(rule);
}
})(libRoot);

export { categories, rules };
6 changes: 5 additions & 1 deletion scripts/update-src-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ const wrapCode = (code: string): string => `/**
* 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<void> => {
Expand Down
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es2015.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -86,3 +88,5 @@ export default {
'es-roikoren/no-weak-set': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es2016.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es2017.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -15,3 +17,5 @@ export default {
'es-roikoren/no-trailing-function-commas': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es2018.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -15,3 +17,5 @@ export default {
'es-roikoren/no-rest-spread-properties': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es2019.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -14,3 +16,5 @@ export default {
'es-roikoren/no-symbol-prototype-description': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es2020.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -16,3 +18,5 @@ export default {
'es-roikoren/no-string-prototype-matchall': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es2021.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -12,3 +14,5 @@ export default {
'es-roikoren/no-weakrefs': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-es5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -37,3 +39,5 @@ export default {
'es-roikoren/no-trailing-commas': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/no-new-in-esnext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -12,3 +14,5 @@ export default {
'es-roikoren/no-regexp-d-flag': 'error',
},
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/restrict-to-es2015.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -12,3 +14,5 @@ export default {
require.resolve('./no-new-in-es2016'),
],
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/restrict-to-es2016.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -11,3 +13,5 @@ export default {
require.resolve('./no-new-in-es2017'),
],
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/restrict-to-es2017.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
* 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'),
require.resolve('./no-new-in-es2018'),
],
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/restrict-to-es2018.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
8 changes: 7 additions & 1 deletion src/configs/restrict-to-es2019.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 5 additions & 1 deletion src/configs/restrict-to-es2020.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 5 additions & 1 deletion src/configs/restrict-to-es3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -14,3 +16,5 @@ export default {
require.resolve('./no-new-in-es5'),
],
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/restrict-to-es5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -13,3 +15,5 @@ export default {
require.resolve('./no-new-in-es2015'),
],
};

export default config;
6 changes: 5 additions & 1 deletion src/configs/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -14,3 +16,5 @@ export default {
'es-roikoren/no-trailing-function-commas': 'off',
},
};

export default config;
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "./tsconfig.prod.json",
"compilerOptions": {
"noEmit": true
"noEmit": true,
"noImplicitAny": true
},
"exclude": ["**/dist/**/*"],
"include": [
Expand Down

0 comments on commit f2b7cd8

Please sign in to comment.