Skip to content

Commit 1b5a398

Browse files
feat: add more than 100 fields rules (#62)
* feat: warning is thrown if an entity has more than 100 fields * fix: rule tester import error * Update src/rules/graphql/no-more-than-100-fields.ts Co-authored-by: Kevin Hawkins <[email protected]> * Update src/rules/graphql/no-more-than-100-fields.ts Co-authored-by: Kevin Hawkins <[email protected]> * fix: check entity record size before warning is issued. * fix: root query has the over 100 fields warning * fix: remove wrong comment --------- Co-authored-by: Kevin Hawkins <[email protected]>
1 parent 90a30d0 commit 1b5a398

File tree

8 files changed

+1507
-47
lines changed

8 files changed

+1507
-47
lines changed

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
node: [18, 20]
1010
name: Linting on Ubuntu with Node ${{ matrix.node }}
1111
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-node@v3
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
1414
with:
1515
node-version: ${{ matrix.node }}
1616
cache: 'npm'

.github/workflows/prettier.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: prettier
22
run-name: Installs project and runs prettier checks
3-
on: [ push, pull_request ]
3+
on: [push, pull_request]
44
jobs:
5-
lint:
6-
runs-on: ubuntu-latest
7-
strategy:
8-
matrix:
9-
node: [ 18, 20 ]
10-
name: Prettier on Ubuntu with Node ${{ matrix.node }}
11-
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-node@v3
14-
with:
15-
node-version: ${{ matrix.node }}
16-
cache: 'npm'
17-
- run: npm install
18-
- run: npm run format
5+
lint:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
node: [18, 20]
10+
name: Prettier on Ubuntu with Node ${{ matrix.node }}
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: ${{ matrix.node }}
16+
cache: 'npm'
17+
- run: npm install
18+
- run: npm run format

.github/workflows/run-tests.yml

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
name: run-tests
22
run-name: Installs project and runs tests
3-
on: [ push, pull_request ]
3+
on: [push, pull_request]
44
jobs:
5-
run-tests-nix:
6-
runs-on: ubuntu-latest
7-
strategy:
8-
matrix:
9-
node: [ 18, 20 ]
10-
name: Run tests on Ubuntu with Node ${{ matrix.node }}
11-
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-node@v3
14-
with:
15-
node-version: ${{ matrix.node }}
16-
cache: 'npm'
17-
- run: npm install
18-
- run: npm run test
19-
run-tests-win:
20-
runs-on: windows-latest
21-
strategy:
22-
matrix:
23-
node: [ 18, 20 ]
24-
name: Run tests on Windows with Node ${{ matrix.node }}
25-
steps:
26-
- uses: actions/checkout@v3
27-
- uses: actions/setup-node@v3
28-
with:
29-
node-version: ${{ matrix.node }}
30-
cache: 'npm'
31-
- run: npm install
32-
- run: npm run test
5+
run-tests-nix:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
node: [18, 20]
10+
name: Run tests on Ubuntu with Node ${{ matrix.node }}
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: ${{ matrix.node }}
16+
cache: 'npm'
17+
- run: npm install
18+
- run: npm run test
19+
run-tests-win:
20+
runs-on: windows-latest
21+
strategy:
22+
matrix:
23+
node: [18, 20]
24+
name: Run tests on Windows with Node ${{ matrix.node }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node }}
30+
cache: 'npm'
31+
- run: npm install
32+
- run: npm run test

src/configs/recommended.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID } from '../rules/graphql/no-semi-an
1414
import { NO_MORE_THAN_1_PARENT_RECORD_RULE_ID } from '../rules/graphql/no-more-than-1-parent-record.js';
1515
import { NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-child-entities.js';
1616
import { NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-root-entities.js';
17+
import { NO_MORE_THAN_100_FIELDS_RULE_ID } from '../rules/graphql/no-more-than-100-fields.js';
1718
import { createScopedModuleRuleName } from '../util/rule-helpers.js';
1819

1920
export = {
@@ -41,6 +42,7 @@ export = {
4142
[createScopedModuleRuleName(NO_MORE_THAN_1_PARENT_RECORD_RULE_ID)]: 'warn',
4243
[createScopedModuleRuleName(NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID)]: 'warn',
4344
[createScopedModuleRuleName(NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID)]: 'warn',
45+
[createScopedModuleRuleName(NO_MORE_THAN_100_FIELDS_RULE_ID)]: 'warn',
4446
[createScopedModuleRuleName(UNSUPPORTED_SCOPE_RULE_ID)]: 'warn'
4547
}
4648
}

src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import {
2828
rule as fiscalDataFilteringNotSupported
2929
} from './rules/graphql/no-fiscal-date-filtering-supported.js';
3030

31+
import {
32+
NO_MORE_THAN_100_FIELDS_RULE_ID,
33+
rule as noMoreThan100Fields
34+
} from './rules/graphql/no-more-than-100-fields.js';
3135
import {
3236
NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID,
3337
rule as noSemiAntiJoinSupported
@@ -67,6 +71,7 @@ export = {
6771
[NO_MORE_THAN_1_PARENT_RECORD_RULE_ID]: noMoreThan1ParentRecord,
6872
[NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID]: noMoreThan3ChildEntities,
6973
[NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID]: noMoreThan3RootEntities,
74+
[NO_MORE_THAN_100_FIELDS_RULE_ID]: noMoreThan100Fields,
7075
[NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID]: noSemiAntiJoinSupported,
7176
[UNSUPPORTED_SCOPE_RULE_ID]: unsupportedScope
7277
}

0 commit comments

Comments
 (0)