Fix up prettier config, apply to more files (#10542)
This commit is contained in:
@@ -5,10 +5,14 @@
|
|||||||
!**/*.jsx
|
!**/*.jsx
|
||||||
!**/*.ts
|
!**/*.ts
|
||||||
!**/*.tsx
|
!**/*.tsx
|
||||||
|
!**/*.mjs
|
||||||
|
!**/*.cjs
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
!**/*.css
|
!**/*.css
|
||||||
|
|
||||||
|
!**/pnpm-workspace.yaml
|
||||||
|
|
||||||
# More specific ignores go below.
|
# More specific ignores go below.
|
||||||
.expo
|
.expo
|
||||||
android
|
android
|
||||||
|
|||||||
+45
-30
@@ -1,7 +1,7 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
import js from '@eslint/js'
|
import js from '@eslint/js'
|
||||||
import tseslint from 'typescript-eslint'
|
import tseslint from 'typescript-eslint'
|
||||||
import { defineConfig } from 'eslint/config';
|
import {defineConfig} from 'eslint/config'
|
||||||
import react from 'eslint-plugin-react'
|
import react from 'eslint-plugin-react'
|
||||||
import reactHooks from 'eslint-plugin-react-hooks'
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
// @ts-expect-error no types
|
// @ts-expect-error no types
|
||||||
@@ -184,24 +184,30 @@ export default defineConfig(
|
|||||||
* Import linting
|
* Import linting
|
||||||
*/
|
*/
|
||||||
'import-x/consistent-type-specifier-style': ['warn', 'prefer-inline'],
|
'import-x/consistent-type-specifier-style': ['warn', 'prefer-inline'],
|
||||||
'import-x/no-unresolved': ['error', {
|
'import-x/no-unresolved': [
|
||||||
/*
|
'error',
|
||||||
* The `postinstall` hook runs `compile-if-needed` locally, but not in
|
{
|
||||||
* CI. For CI-sake, ignore this.
|
/*
|
||||||
*/
|
* The `postinstall` hook runs `compile-if-needed` locally, but not in
|
||||||
ignore: ['^#\/locale\/locales\/.+\/messages'],
|
* CI. For CI-sake, ignore this.
|
||||||
}],
|
*/
|
||||||
'import-x/no-extraneous-dependencies': ['error', {
|
ignore: ['^#\/locale\/locales\/.+\/messages'],
|
||||||
'whitelist': [
|
},
|
||||||
// test files only
|
],
|
||||||
'@jest/globals',
|
'import-x/no-extraneous-dependencies': [
|
||||||
// we only use a really simple util from this, and we know it will be present
|
'error',
|
||||||
'expo-modules-core',
|
{
|
||||||
// this is a dep for @atproto/api, but we absolutely need them in sync, so just
|
whitelist: [
|
||||||
// rely on the transient version
|
// test files only
|
||||||
'@atproto/common-web',
|
'@jest/globals',
|
||||||
]
|
// we only use a really simple util from this, and we know it will be present
|
||||||
}],
|
'expo-modules-core',
|
||||||
|
// this is a dep for @atproto/api, but we absolutely need them in sync, so just
|
||||||
|
// rely on the transient version
|
||||||
|
'@atproto/common-web',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
'import-x/no-nodejs-modules': 'error',
|
'import-x/no-nodejs-modules': 'error',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,9 +228,12 @@ export default defineConfig(
|
|||||||
{prefer: 'type-imports', fixStyle: 'inline-type-imports'},
|
{prefer: 'type-imports', fixStyle: 'inline-type-imports'},
|
||||||
],
|
],
|
||||||
'@typescript-eslint/no-require-imports': 'off',
|
'@typescript-eslint/no-require-imports': 'off',
|
||||||
'@typescript-eslint/no-unused-expressions': ['error', {
|
'@typescript-eslint/no-unused-expressions': [
|
||||||
allowTernary: true,
|
'error',
|
||||||
}],
|
{
|
||||||
|
allowTernary: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
/**
|
/**
|
||||||
* Maintain previous behavior - these are stricter in typescript-eslint
|
* Maintain previous behavior - these are stricter in typescript-eslint
|
||||||
* v8 `warn` ones are probably worth fixing. `off` ones are a bit too
|
* v8 `warn` ones are probably worth fixing. `off` ones are a bit too
|
||||||
@@ -251,13 +260,19 @@ export default defineConfig(
|
|||||||
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
|
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
|
||||||
'@typescript-eslint/await-thenable': 'warn',
|
'@typescript-eslint/await-thenable': 'warn',
|
||||||
|
|
||||||
"no-restricted-imports": ["error", {
|
'no-restricted-imports': [
|
||||||
"paths": [{
|
'error',
|
||||||
"name": "react",
|
{
|
||||||
"importNames": ["React", "default"],
|
paths: [
|
||||||
"message": "React is already in the global type namespace. Use named imports for runtime modules."
|
{
|
||||||
}]
|
name: 'react',
|
||||||
}],
|
importNames: ['React', 'default'],
|
||||||
|
message:
|
||||||
|
'React is already in the global type namespace. Use named imports for runtime modules.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn off rules that we haven't enforced thus far
|
* Turn off rules that we haven't enforced thus far
|
||||||
@@ -298,7 +313,7 @@ export default defineConfig(
|
|||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
...globals.jest,
|
...globals.jest,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
module.exports = {
|
import {type Config} from 'prettier'
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
semi: false,
|
semi: false,
|
||||||
arrowParens: 'avoid',
|
arrowParens: 'avoid',
|
||||||
bracketSameLine: true,
|
bracketSameLine: true,
|
||||||
@@ -6,3 +8,5 @@ module.exports = {
|
|||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
trailingComma: 'all',
|
trailingComma: 'all',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
@@ -136,7 +136,14 @@ for (const [pkg, files] of groups) {
|
|||||||
try {
|
try {
|
||||||
execFileSync(
|
execFileSync(
|
||||||
'patch',
|
'patch',
|
||||||
[`-p${stripLevel}`, '-l', '-N', '--no-backup-if-mismatch', '-i', patchPath],
|
[
|
||||||
|
`-p${stripLevel}`,
|
||||||
|
'-l',
|
||||||
|
'-N',
|
||||||
|
'--no-backup-if-mismatch',
|
||||||
|
'-i',
|
||||||
|
patchPath,
|
||||||
|
],
|
||||||
{cwd: tmp, stdio: 'pipe'},
|
{cwd: tmp, stdio: 'pipe'},
|
||||||
)
|
)
|
||||||
console.log(` applied ${file} (via GNU patch -l)`)
|
console.log(` applied ${file} (via GNU patch -l)`)
|
||||||
@@ -146,16 +153,17 @@ for (const [pkg, files] of groups) {
|
|||||||
|
|
||||||
// If reversing applies, the patch is already in upstream -- stale.
|
// If reversing applies, the patch is already in upstream -- stale.
|
||||||
try {
|
try {
|
||||||
execFileSync(
|
execFileSync('git', [...gitArgs, '--reverse', '--check', patchPath], {
|
||||||
'git',
|
cwd: tmp,
|
||||||
[...gitArgs, '--reverse', '--check', patchPath],
|
stdio: 'pipe',
|
||||||
{cwd: tmp, stdio: 'pipe'},
|
})
|
||||||
)
|
|
||||||
console.log(` STALE ${file} (already in upstream, skipping)`)
|
console.log(` STALE ${file} (already in upstream, skipping)`)
|
||||||
stale++
|
stale++
|
||||||
} catch {
|
} catch {
|
||||||
console.error(` FAILED ${file} (does not apply, not stale)`)
|
console.error(` FAILED ${file} (does not apply, not stale)`)
|
||||||
throw new Error(`patch ${file} does not apply against ${pkg}@${version}`)
|
throw new Error(
|
||||||
|
`patch ${file} does not apply against ${pkg}@${version}`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user