chore: move to eslint v9 (#7041)
- Upgrades eslint from v8 to v9 - Upgrades all other eslint packages. We will have to do a new full-project lint, as new rules have been added - Upgrades husky from v8 to v9 - Upgrades lint-staged from v14 to v15 - Moves the old .eslintrc.cjs file format to the new eslint.config.js flat file format. Previously, we were very specific regarding which rules are applied to which files. Now that `extends` is no longer a thing, I have to use deepMerge & imports instead. This is rather uncommon and is not a documented pattern - e.g. typescript-eslint docs want us to add the default typescript-eslint rules to the top-level & then disable it in files using the disable-typechecked config. However, I hate this opt-out approach. The way I did it here adds a lot of clarity as to which rules are applied to which files, and is pretty easy to read. Much less black magic ## .eslintignore These files are no longer supported (see https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files). I moved the entries to the ignores property in the eslint config. => one less file in each package folder!
This commit is contained in:
@@ -422,9 +422,9 @@ describe('access control', () => {
|
||||
existingDoc = await payload.create({
|
||||
collection: docLevelAccessSlug,
|
||||
data: {
|
||||
approvedForRemoval: false,
|
||||
approvedTitle: 'Title',
|
||||
lockTitle: true,
|
||||
approvedForRemoval: false,
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -466,12 +466,12 @@ describe('access control', () => {
|
||||
await page.waitForURL(logoutURL)
|
||||
|
||||
await login({
|
||||
page,
|
||||
serverURL,
|
||||
data: {
|
||||
email: noAdminAccessEmail,
|
||||
password: 'test',
|
||||
},
|
||||
page,
|
||||
serverURL,
|
||||
})
|
||||
|
||||
await expect(page.locator('.next-error-h1')).toBeVisible()
|
||||
@@ -481,12 +481,12 @@ describe('access control', () => {
|
||||
|
||||
// Log back in for the next test
|
||||
await login({
|
||||
page,
|
||||
serverURL,
|
||||
data: {
|
||||
email: devUser.email,
|
||||
password: devUser.password,
|
||||
},
|
||||
page,
|
||||
serverURL,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -500,9 +500,9 @@ describe('access control', () => {
|
||||
await page.goto(logoutURL)
|
||||
await page.waitForURL(logoutURL)
|
||||
|
||||
const nonAdminUser: NonAdminUser & {
|
||||
const nonAdminUser: {
|
||||
token?: string
|
||||
} = await payload.login({
|
||||
} & NonAdminUser = await payload.login({
|
||||
collection: nonAdminUserSlug,
|
||||
data: {
|
||||
email: nonAdminUserEmail,
|
||||
@@ -513,8 +513,8 @@ describe('access control', () => {
|
||||
await context.addCookies([
|
||||
{
|
||||
name: 'payload-token',
|
||||
value: nonAdminUser.token,
|
||||
url: serverURL,
|
||||
value: nonAdminUser.token,
|
||||
},
|
||||
])
|
||||
|
||||
@@ -554,10 +554,9 @@ describe('access control', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
async function createDoc(data: any): Promise<TypeWithID & Record<string, unknown>> {
|
||||
async function createDoc(data: any): Promise<Record<string, unknown> & TypeWithID> {
|
||||
return payload.create({
|
||||
collection: slug,
|
||||
data,
|
||||
}) as any as Promise<TypeWithID & Record<string, unknown>>
|
||||
}) as any as Promise<Record<string, unknown> & TypeWithID>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user