chore: run eslint & prettier, adjust perfectionist sorting for package.json and tsconfig.json in eslint configs

This commit is contained in:
Alessio Gravili
2023-09-19 11:41:56 +02:00
parent 4f68b722dc
commit cdaa0acd61
332 changed files with 17301 additions and 3409 deletions

View File

@@ -6,6 +6,28 @@ module.exports = {
extends: ['plugin:@typescript-eslint/disable-type-checked'],
files: ['*.js', '*.cjs', '*.json', '*.md', '*.yml', '*.yaml'],
},
{
files: ['package.json', 'tsconfig.json'],
rules: {
'perfectionist/sort-array-includes': 'off',
'perfectionist/sort-astro-attributes': 'off',
'perfectionist/sort-classes': 'off',
'perfectionist/sort-enums': 'off',
'perfectionist/sort-exports': 'off',
'perfectionist/sort-imports': 'off',
'perfectionist/sort-interfaces': 'off',
'perfectionist/sort-jsx-props': 'off',
'perfectionist/sort-keys': 'off',
'perfectionist/sort-maps': 'off',
'perfectionist/sort-named-exports': 'off',
'perfectionist/sort-named-imports': 'off',
'perfectionist/sort-object-types': 'off',
'perfectionist/sort-objects': 'off',
'perfectionist/sort-svelte-attributes': 'off',
'perfectionist/sort-union-types': 'off',
'perfectionist/sort-vue-attributes': 'off',
},
},
],
parserOptions: {
project: ['./tsconfig.json'],

View File

@@ -15,11 +15,11 @@ type Arguments = {
}
export const populate = async ({
id,
collection,
currentDepth,
data,
depth,
id,
key,
overrideAccess,
req,

View File

@@ -36,12 +36,12 @@ export const recurseNestedFields = ({
if (collection) {
promises.push(
populate({
id: value,
collection,
currentDepth,
data: data[field.name],
depth,
field,
id: value,
key: i,
overrideAccess,
req,
@@ -56,12 +56,12 @@ export const recurseNestedFields = ({
if (collection) {
promises.push(
populate({
id,
collection,
currentDepth,
data: data[field.name],
depth,
field,
id,
key: i,
overrideAccess,
req,
@@ -79,12 +79,12 @@ export const recurseNestedFields = ({
const collection = req.payload.collections[data[field.name].relationTo]
promises.push(
populate({
id: data[field.name].value,
collection,
currentDepth,
data: data[field.name],
depth,
field,
id: data[field.name].value,
key: 'value',
overrideAccess,
req,
@@ -97,12 +97,12 @@ export const recurseNestedFields = ({
const collection = req.payload.collections[field.relationTo]
promises.push(
populate({
id: data[field.name],
collection,
currentDepth,
data,
depth,
field,
id: data[field.name],
key: field.name,
overrideAccess,
req,

View File

@@ -40,12 +40,12 @@ export const recurseRichText = ({
if (collection) {
promises.push(
populate({
id: element.value.id,
collection,
currentDepth,
data: element,
depth,
field,
id: element.value.id,
key: 'value',
overrideAccess,
req,
@@ -77,12 +77,12 @@ export const recurseRichText = ({
if (collection) {
promises.push(
populate({
id: element.doc.value,
collection,
currentDepth,
data: element.doc,
depth,
field,
id: element.doc.value,
key: 'value',
overrideAccess,
req,

View File

@@ -55,6 +55,7 @@ declare module 'slate' {
const RichText: React.FC<FieldProps> = (props) => {
const {
name,
admin: {
className,
condition,
@@ -77,7 +78,6 @@ const RichText: React.FC<FieldProps> = (props) => {
admin,
defaultValue: defaultValueFromProps,
label,
name,
path: pathFromProps,
required,
validate = richText,

View File

@@ -16,18 +16,18 @@ const translations = extractTranslations([
export const getBaseFields = (config: Config): Field[] => [
{
label: translations['fields:textToDisplay'],
name: 'text',
label: translations['fields:textToDisplay'],
required: true,
type: 'text',
},
{
name: 'linkType',
admin: {
description: translations['fields:chooseBetweenCustomTextOrDocument'],
},
defaultValue: 'custom',
label: translations['fields:linkType'],
name: 'linkType',
options: [
{
label: translations['fields:customURL'],
@@ -42,22 +42,22 @@ export const getBaseFields = (config: Config): Field[] => [
type: 'radio',
},
{
name: 'url',
admin: {
condition: ({ linkType }) => linkType !== 'internal',
},
label: translations['fields:enterURL'],
name: 'url',
required: true,
type: 'text',
},
{
name: 'doc',
admin: {
condition: ({ linkType }) => {
return linkType === 'internal'
},
},
label: translations['fields:chooseDocumentToLink'],
name: 'doc',
relationTo: config.collections
.filter(({ admin: { enableRichTextLink } }) => enableRichTextLink)
.map(({ slug }) => slug),
@@ -65,8 +65,8 @@ export const getBaseFields = (config: Config): Field[] => [
type: 'relationship',
},
{
label: translations['fields:openInNewTab'],
name: 'newTab',
label: translations['fields:openInNewTab'],
type: 'checkbox',
},
]

View File

@@ -80,6 +80,7 @@ export function transformExtraFields(
if (Array.isArray(customFieldSchema) || fields.length > 0) {
fields.push({
name: 'fields',
admin: {
style: {
borderBottom: 0,
@@ -91,7 +92,6 @@ export function transformExtraFields(
fields: Array.isArray(customFieldSchema)
? customFieldSchema.concat(extraFields)
: extraFields,
name: 'fields',
type: 'group',
})
}

View File

@@ -6,6 +6,7 @@ import AlignRightIcon from '../../icons/AlignRight'
import ElementButton from '../Button'
export default {
name: 'alignment',
Button: () => {
return (
<React.Fragment>
@@ -21,5 +22,4 @@ export default {
</React.Fragment>
)
},
name: 'alignment',
}