Skip to content

Commit 896fc97

Browse files
adjust rules, fix type checked rules being disabled (#242)
Signed-off-by: Kangrui Johann Ye <[email protected]>
1 parent db5b3ef commit 896fc97

File tree

29 files changed

+44
-208
lines changed

29 files changed

+44
-208
lines changed

eslint.config.mjs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ export default tseslint.config(
1717
'packages/eslint-plugin-angular/src/configs/format-template.ts',
1818
'packages/eslint-plugin-react/*',
1919
'packages/eslint-plugin-typescript/src/configs/index.ts',
20-
'packages/eslint-plugin-typescript/src/configs/recommended/*',
21-
'packages/eslint-plugin-typescript/src/configs/recommended-json/*',
22-
'packages/eslint-plugin-typescript/src/configs/recommended-package/*',
23-
'packages/eslint-plugin-typescript/src/configs/recommended-typescript/recommended-typescript.config.ts',
24-
'packages/eslint-plugin-typescript/src/configs/recommended-typescript/rules/format.ts',
25-
'packages/eslint-plugin-typescript/src/configs/recommended-typescript/rules/import.ts',
26-
'packages/eslint-plugin-typescript/src/configs/recommended-typescript/rules/rxjs.ts',
20+
'packages/eslint-plugin-typescript/src/configs/json.ts',
21+
'packages/eslint-plugin-typescript/src/configs/package.ts',
22+
'packages/eslint-plugin-typescript/src/configs/format.ts',
23+
'packages/eslint-plugin-typescript/src/configs/import.ts',
24+
'packages/eslint-plugin-typescript/src/configs/rxjs.ts',
2725
'packages/eslint-plugin-typescript/src/rules/package/*',
2826
'packages/eslint-plugin-typescript/src/rules/ts-config/*',
2927
'packages/eslint-plugin-typescript/src/rules/typescript/*.spec.ts',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflight/eslint-plugin",
3-
"version": "1.0.0-rc4",
3+
"version": "1.0.0-rc5",
44
"private": true,
55
"volta": {
66
"node": "20.12.2",

packages/eslint-plugin-angular/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ import { includeIgnoreFile } from '@eslint/compat';
4141
import { dirname, normalize, resolve } from 'node:path';
4242
import { fileURLToPath } from 'node:url';
4343

44-
const __filename = fileURLToPath(import.meta.url);
45-
const __dirname = dirname(__filename);
46-
const gitignorePath = normalize(resolve(__dirname, '.gitignore'));
44+
const directory = dirname(fileURLToPath(import.meta.url));
45+
const gitignorePath = normalize(resolve(directory, '.gitignore'));
4746

4847
export default [
4948
includeIgnoreFile(gitignorePath),
5049
...cloudflightAngularConfig,
5150
{
5251
languageOptions: {
5352
parserOptions: {
54-
project: ['tsconfig.*?.json'],
53+
project: ['tsconfig*(.*).json'],
5554
tsconfigRootDir: import.meta.dirname,
5655
},
5756
},

packages/eslint-plugin-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflight/eslint-plugin-angular",
3-
"version": "1.0.0-rc4",
3+
"version": "1.0.0-rc5",
44
"description": "Cloudflight eslint-plugin & eslint-config for angular",
55
"volta": {
66
"extends": "../../package.json"

packages/eslint-plugin-angular/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {angularEslintRules} from './configs/angular-eslint';
77
import {angularTemplateEslintRules} from './configs/angular-eslint-template';
88

99
export const cloudflightAngularTypescriptConfig = tseslint.config(
10+
...cloudflightTypescriptConfig,
1011
{
1112
files: ['**/*.{ts,mts,cts}'],
1213
extends: [
13-
...cloudflightTypescriptConfig,
1414
...angular.configs.tsRecommended,
1515
],
1616
processor: angular.processInlineTemplates,

packages/eslint-plugin-node/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@ import { includeIgnoreFile } from '@eslint/compat';
3232
import { dirname, normalize, resolve } from 'node:path';
3333
import { fileURLToPath } from 'node:url';
3434

35-
const __filename = fileURLToPath(import.meta.url);
36-
const __dirname = dirname(__filename);
37-
const gitignorePath = normalize(resolve(__dirname, '.gitignore'));
35+
const directory = dirname(fileURLToPath(import.meta.url));
36+
const gitignorePath = normalize(resolve(directory, '.gitignore'));
3837

3938
export default [
4039
includeIgnoreFile(gitignorePath),
4140
...cloudflightNodeConfig,
4241
{
4342
languageOptions: {
4443
parserOptions: {
45-
project: ['tsconfig.*?.json'],
44+
project: ['tsconfig*(.*).json'],
4645
tsconfigRootDir: import.meta.dirname,
4746
},
4847
},

packages/eslint-plugin-node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflight/eslint-plugin-node",
3-
"version": "1.0.0-rc4",
3+
"version": "1.0.0-rc5",
44
"description": "Cloudflight eslint-plugin & eslint-config for node",
55
"volta": {
66
"extends": "../../package.json"

packages/eslint-plugin-node/src/configs/node.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ export const nodeRules: TSESLint.Linter.RulesRecord = {
44
// require all requires be top-level
55
'n/global-require': 'error',
66

7-
// allow typescript files
8-
'n/no-missing-import': [
9-
'error',
10-
{
11-
tryExtensions: ['.js', '.ts', '.json', '.node'],
12-
},
13-
],
7+
// disabled because of https://github.com/eslint-community/eslint-plugin-n/issues/349
8+
'n/no-missing-import': 'off',
149

1510
// disallow use of new operator with the require function
1611
'n/no-new-require': 'error',

packages/eslint-plugin-node/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {securityRules} from './configs/security';
77
import {nodeRules} from './configs/node';
88

99
export const cloudflightNodeConfig = tseslint.config(
10+
...cloudflightTypescriptConfig,
1011
{
1112
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
1213
extends: [
13-
...cloudflightTypescriptConfig,
1414
pluginNode.configs['flat/recommended'],
1515
nounsanitized.configs.recommended,
1616
pluginSecurity.configs.recommended,

packages/eslint-plugin-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflight/eslint-plugin-react",
3-
"version": "1.0.0-rc4",
3+
"version": "1.0.0-rc5",
44
"description": "Cloudflight eslint-plugin & eslint-config for React",
55
"volta": {
66
"extends": "../../package.json"

packages/eslint-plugin-typescript/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The Cloudflight ESLint Plugin Typescript provides a configuration of ESLint rules recommended by Cloudflight.
44

5-
You can find the directory of all rules including their reasoning [here](src/configs/recommended-typescript/rules).
5+
You can find the directory of all rules including their reasoning [here](src/configs).
66

77
## Dependencies
88

@@ -32,17 +32,16 @@ import { includeIgnoreFile } from '@eslint/compat';
3232
import { dirname, normalize, resolve } from 'node:path';
3333
import { fileURLToPath } from 'node:url';
3434

35-
const __filename = fileURLToPath(import.meta.url);
36-
const __dirname = dirname(__filename);
37-
const gitignorePath = normalize(resolve(__dirname, '.gitignore'));
35+
const directory = dirname(fileURLToPath(import.meta.url));
36+
const gitignorePath = normalize(resolve(directory, '.gitignore'));
3837

3938
export default [
4039
includeIgnoreFile(gitignorePath),
4140
...cloudflightTypescriptConfig,
4241
{
4342
languageOptions: {
4443
parserOptions: {
45-
project: ['tsconfig.*?.json'],
44+
project: ['tsconfig*(.*).json'],
4645
tsconfigRootDir: import.meta.dirname,
4746
},
4847
},

packages/eslint-plugin-typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflight/eslint-plugin-typescript",
3-
"version": "1.0.0-rc4",
3+
"version": "1.0.0-rc5",
44
"description": "Cloudflight eslint-plugin & eslint-config for typescript",
55
"volta": {
66
"extends": "../../package.json"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {TSESLint} from '@typescript-eslint/utils';
22

3-
import {NoMomentJsRuleName} from '../../../rules/typescript/no-moment-js';
4-
import {NoOnEventAssignName} from '../../../rules/typescript/no-on-event-assign';
3+
import {NoMomentJsRuleName} from '../rules/typescript/no-moment-js';
4+
import {NoOnEventAssignName} from '../rules/typescript/no-on-event-assign';
55

66
const pluginPrefix = '@cloudflight/typescript';
77

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const eslintRules: TSESLint.Linter.RulesRecord = {
1010
'default-case': 'off',
1111
eqeqeq: ['error', 'always', {null: 'ignore'}],
1212
'max-classes-per-file': ['error', 1],
13-
'new-parens': ['error'],
1413
'no-async-promise-executor': ['error'],
1514
'no-bitwise': ['error'],
1615
'no-console': ['error'],
@@ -52,7 +51,6 @@ export const eslintRules: TSESLint.Linter.RulesRecord = {
5251
'no-proto': ['error'],
5352
'no-implied-eval': ['error'],
5453
'no-iterator': ['error'],
55-
'no-floating-decimal': ['error'],
5654
'no-caller': ['error'],
5755
'no-empty-pattern': ['error'],
5856
'no-extend-native': ['error'],
@@ -70,16 +68,13 @@ export const eslintRules: TSESLint.Linter.RulesRecord = {
7068
'no-compare-neg-zero': ['error'],
7169
'no-cond-assign': ['error', 'always'],
7270
'no-nested-ternary': ['error'],
73-
'no-new-object': ['error'],
7471
'no-lonely-if': ['error'],
7572
'no-shadow-restricted-names': ['error'],
7673
'no-undef-init': ['error'],
7774
'no-multi-assign': ['error'],
7875
'no-multi-str': ['error'],
7976
'no-useless-computed-key': ['error'],
8077
'no-case-declarations': ['error'],
81-
'no-tabs': ['error'],
82-
'semi-style': ['error', 'last'],
8378
'default-case-last': ['error'],
8479
'unicode-bom': ['error', 'never'],
8580
'for-direction': ['error'],
@@ -105,21 +100,13 @@ export const eslintRules: TSESLint.Linter.RulesRecord = {
105100
'symbol-description': ['error'],
106101
strict: ['error', 'never'],
107102
yoda: ['error'],
108-
'quote-props': ['error', 'as-needed'],
109103
radix: ['error'],
110104
'require-yield': ['error'],
111105
'use-isnan': ['error'],
112106
'func-style': ['error', 'declaration'],
113107
'func-names': ['warn'],
114108
'one-var': ['error', 'never'],
115109
'one-var-declaration-per-line': ['error', 'always'],
116-
'nonblock-statement-body-position': [
117-
'error',
118-
'beside',
119-
{
120-
overrides: {},
121-
},
122-
],
123110
camelcase: [
124111
'error',
125112
{
@@ -290,55 +277,6 @@ export const eslintRules: TSESLint.Linter.RulesRecord = {
290277
defaultAssignment: false,
291278
},
292279
],
293-
'no-mixed-operators': [
294-
'error',
295-
{
296-
groups: [
297-
[
298-
'%',
299-
'**',
300-
],
301-
[
302-
'%',
303-
'+',
304-
],
305-
[
306-
'%',
307-
'-',
308-
],
309-
[
310-
'%',
311-
'*',
312-
],
313-
[
314-
'%',
315-
'/',
316-
],
317-
[
318-
'/',
319-
'*',
320-
],
321-
[
322-
'&',
323-
'|',
324-
'<<',
325-
'>>',
326-
'>>>',
327-
],
328-
[
329-
'==',
330-
'!=',
331-
'===',
332-
'!==',
333-
],
334-
[
335-
'&&',
336-
'||',
337-
],
338-
],
339-
allowSamePrecedence: false,
340-
},
341-
],
342280
'no-restricted-globals': [
343281
'error',
344282
{
@@ -414,13 +352,6 @@ export const eslintRules: TSESLint.Linter.RulesRecord = {
414352
allowImplicit: true,
415353
},
416354
],
417-
'no-confusing-arrow': [
418-
'error',
419-
{
420-
allowParens: true,
421-
onlyOneSimpleParam: false,
422-
},
423-
],
424355
'no-useless-rename': [
425356
'error',
426357
{

packages/eslint-plugin-typescript/src/configs/index.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/eslint-plugin-typescript/src/configs/recommended-json/recommended-json.config.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/eslint-plugin-typescript/src/configs/recommended-package/recommended-package.config.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/eslint-plugin-typescript/src/configs/recommended-typescript/recommended-typescript.config.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)