Skip to content

Commit

Permalink
internal: Use eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Sep 9, 2024
1 parent 4e25f4c commit 6c87ceb
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 355 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-lamps-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@data-client/react': patch
---

fix: ExternalDataProvider correctly tracks unmounting
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
setup:
docker: &docker
# specify the version you desire here
- image: cimg/node:22.4
- image: cimg/node:22.7
resource_class: large
steps:
- checkout:
Expand All @@ -18,9 +18,9 @@ jobs:
npm pkg set 'workspaces[]'='examples/*'
- restore_cache:
keys:
- v11-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
- v12-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
# fallback to using the latest cache if no exact match is found
- v11-dependencies-
- v12-dependencies-
- run:
name: yarn install
command: |
Expand All @@ -32,7 +32,7 @@ jobs:
paths:
- .yarn/cache
- .yarn/install-state.gz
key: v11-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
key: v12-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
- run: yarn run ci:build:types
- run: yarn run ci:build
- persist_to_workspace:
Expand All @@ -48,6 +48,7 @@ jobs:
- project/jest.config.js
- project/tsconfig-base.json
- project/tsconfig.json
- project/eslint.config.mjs
- project/yarn.lock
- project/tsconfig.test.json
- project/package.json
Expand All @@ -61,7 +62,7 @@ jobs:
at: ~/
- run:
command: |
yarn lint packages/*/src
yarn lint --quiet packages/*/src
typecheck:
docker: *docker
Expand Down
1 change: 0 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"downlevel-dts",
"immutable",
"@types/lodash",
"cimg/node",
"nock"
],
"timezone": "America/Chicago",
Expand Down
44 changes: 44 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import anansiPlugin from '@anansi/eslint-plugin';
import globals from 'globals';

export default [
...anansiPlugin.configs.typescript,
{
ignores: [
'**/lib*/*',
'**/dist*/*',
'packages/*/native/*',
'**/node_modules*/*',
'node_modules/*',
'**/src-*-types/*',
],
},
{
files: ['**/*.?(m|c)ts?(x)'],
rules: {
'@typescript-eslint/no-empty-function': 'warn',
},
},
{
files: ['**/__tests__/**/*.?(m|c)ts?(x)', '**/*.test?(.*).?(m|c)ts?(x)'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
},
},
{
files: ['**/*.?(m|c)js?(x)'],
settings: {
'import/resolver': {
node: {},
},
},
},
{
languageOptions: {
globals: {
...globals.browser,
process: 'writable',
},
},
},
];
36 changes: 3 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"changeset:version": "run changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install",
"changeset:publish": "run build && run changeset publish",
"lint": "eslint --ext .ts,.tsx,.js",
"lint": "eslint",
"format": "eslint --fix \"packages/*/src/**/*.{js,ts,tsx,cts}\"",
"clean:types": "rimraf packages/*/*.tsbuildinfo",
"build": "yarn build:types && yarn workspaces foreach -Wptiv --no-private run build",
Expand Down Expand Up @@ -66,8 +66,6 @@
"@types/jest": "29.5.12",
"@types/node": "22.5.1",
"@types/react": "18.3.4",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"babel-plugin-module-resolver": "5.0.2",
"benchmark": "^2.1.4",
"conventional-changelog-anansi": "^0.2.0",
Expand All @@ -77,12 +75,8 @@
"cpy-cli": "5.0.0",
"cross-fetch": "^4.0.0",
"downlevel-dts": "^0.10.0",
"eslint": "8.57.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint": "9.9.1",
"globals": "^15.9.0",
"ignore-styles": "^5.0.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
Expand Down Expand Up @@ -123,29 +117,5 @@
"singleQuote": true,
"arrowParens": "avoid",
"experimentalTernaries": true
},
"eslintConfig": {
"extends": [
"plugin:@anansi/typescript"
],
"rules": {
"@typescript-eslint/no-empty-function": "warn"
},
"settings": {
"import/resolver": {
"node": {}
}
},
"globals": {
"process": "writable"
},
"ignorePatterns": [
"**/lib*/*",
"**/dist*/*",
"packages/*/native/*",
"**/node_modules*/*",
"node_modules/*",
"**/src-*-types/*"
]
}
}
1 change: 0 additions & 1 deletion packages/endpoint/src/endpoint.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
import type {
EndpointConstructor,
ExtendableEndpointConstructor,
Expand Down
2 changes: 1 addition & 1 deletion packages/endpoint/src/endpointTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
import type { EndpointInterface, Schema } from './interface.js';
import type {
EndpointExtraOptions,
Expand Down
3 changes: 0 additions & 3 deletions packages/endpoint/src/schemas/EntitySchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { Constructor, EntityOptions } from './EntityTypes.js';
import type {
Schema,
Expand Down Expand Up @@ -378,8 +377,6 @@ export default function EntitySchema<TBase extends Constructor>(
enumerable: true,
});
} else if (!('key' in Base)) {
// this allows assignment in strict-mode
// eslint-disable-next-line no-inner-declarations
function set(this: any, value: string) {
Object.defineProperty(this, 'key', {
value,
Expand Down
1 change: 0 additions & 1 deletion packages/endpoint/src/schemas/ImmutableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @param {any} object
* @return {bool}
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export function isImmutable(object: {}): object is {
get(k: string): any;
[k: string]: any;
Expand Down
1 change: 0 additions & 1 deletion packages/normalizr/src/schemas/ImmutableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { INVALID } from '../denormalize/symbol.js';
* @param {any} object
* @return {bool}
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export function isImmutable(object: {}): object is {
get(k: string): any;
[k: string]: any;
Expand Down
1 change: 0 additions & 1 deletion packages/normalizr/src/schemas/Object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const normalize = (

export const denormalize = (
schema: any,
// eslint-disable-next-line @typescript-eslint/ban-types
input: {},
args: readonly any[],
unvisit: any,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/server/redux/ExternalDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function ExternalDataProvider<S>({
const isMounted = useRef(true);
useEffect(() => {
isMounted.current = true;
() => {
return () => {
isMounted.current = false;
};
}, []);
Expand Down
1 change: 0 additions & 1 deletion packages/rest/src/RestEndpoint.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
import type { RestEndpointConstructor } from './RestEndpointTypes.js';
export * from './RestEndpointTypes.js';

Expand Down
8 changes: 1 addition & 7 deletions packages/rest/src/RestEndpointTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
import type {
EndpointExtraOptions,
EndpointInstanceInterface,
Expand Down Expand Up @@ -529,7 +528,6 @@ export type RestType<
searchParams?: any;
paginationField?: string;
} = { path: string; paginationField: string },
// eslint-disable-next-line @typescript-eslint/ban-types
> = IfTypeScriptLooseNull<
RestInstance<RestFetch<UrlParams, Body, R>, S, M, O>,
Body extends {} ? RestTypeWithBody<UrlParams, S, M, Body, R, O>
Expand Down Expand Up @@ -564,7 +562,6 @@ export type RestTypeNoBody<
/** Simple parameters, and body fetch functions */
export type RestFetch<
UrlParams,
// eslint-disable-next-line @typescript-eslint/ban-types
Body = {},
Resolve = any,
> = IfTypeScriptLooseNull<
Expand Down Expand Up @@ -615,10 +612,7 @@ export type FromFallBack<K extends keyof E, O, E> =
K extends keyof O ? O[K] : E[K];

export type FetchMutate<
A extends readonly any[] = // eslint-disable-next-line @typescript-eslint/ban-types
| [any, {}]
// eslint-disable-next-line @typescript-eslint/ban-types
| [{}],
A extends readonly any[] = [any, {}] | [{}],
R = any,
> = (this: RestInstance, ...args: A) => Promise<R>;

Expand Down
Loading

0 comments on commit 6c87ceb

Please sign in to comment.