Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: update linter config to parse ESM files #3371

Merged
merged 1 commit into from Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions .eslintrc.js
Expand Up @@ -145,6 +145,17 @@ module.exports = {
},

overrides: [
{
files: [
'*.mjs',
'private/dev/*.js',
'private/release/*.js',
'private/remark-lint-uppy/*.js',
],
parserOptions: {
sourceType: 'module',
},
},
{
files: ['./packages/@uppy/companion/**/*.js'],
rules: {
Expand Down
4 changes: 3 additions & 1 deletion packages/uppy/index.mjs
Expand Up @@ -3,8 +3,10 @@ export { default as Core } from '@uppy/core'

// Utilities
export { default as server } from '@uppy/companion-client'
/* eslint-disable */
import ProviderView from '@uppy/provider-views'
export var views = { ProviderView: ProviderView }
export var views = { ProviderView }
/* eslint-enable */

// Stores
export { default as DefaultStore } from '@uppy/store-default'
Expand Down
2 changes: 1 addition & 1 deletion private/locale-pack/helpers.mjs
Expand Up @@ -11,7 +11,7 @@ export function getPaths (globPath) {

export function sortObjectAlphabetically (obj) {
return Object.fromEntries(
Object.entries(obj).sort(([keyA], [keyB]) => keyA.localeCompare(keyB))
Object.entries(obj).sort(([keyA], [keyB]) => keyA.localeCompare(keyB)),
)
}

Expand Down
4 changes: 2 additions & 2 deletions private/locale-pack/index.mjs
Expand Up @@ -106,7 +106,7 @@ function generateTypes (pluginName, locale) {
'@uppy',
pluginName,
'types',
'generatedLocale.d.ts'
'generatedLocale.d.ts',
)

const localeTypes = dedent`
Expand All @@ -131,7 +131,7 @@ function generateLocaleDocs (pluginName) {

if (!fs.existsSync(docPath)) {
console.error(
`⚠️ Could not find markdown documentation file for "${pluginName}". Make sure the plugin name matches the markdown file name.`
`⚠️ Could not find markdown documentation file for "${pluginName}". Make sure the plugin name matches the markdown file name.`,
)
return
}
Expand Down
10 changes: 5 additions & 5 deletions private/locale-pack/test.mjs
Expand Up @@ -76,7 +76,7 @@ function getAllFilesPerPlugin (pluginNames) {

if (name in pluginLocaleDependencies) {
filesPerPlugin[name] = filesPerPlugin[name].concat(
getFiles(pluginLocaleDependencies[name])
getFiles(pluginLocaleDependencies[name]),
)
}
}
Expand All @@ -93,14 +93,14 @@ async function unused (filesPerPlugin, data) {
'@uppy',
name,
'src',
'locale.js'
'locale.js',
)
const locale = (await import(localePath)).default

for (const key of Object.keys(locale.strings)) {
const regPat = new RegExp(
`(i18n|i18nArray)\\([^\\)]*['\`"]${key}['\`"]`,
'g'
'g',
)
if (!fileString.match(regPat)) {
return Promise.reject(new Error(`Unused locale key "${key}" in @uppy/${name}`))
Expand Down Expand Up @@ -136,7 +136,7 @@ function warnings ({ leadingLocale, followerLocales }) {
`${chalk.cyan(name)} locale has missing string: '${chalk.red(key)}'`,
`that is present in ${chalk.cyan(leadingLocaleName)}`,
`with value: ${chalk.yellow(value)}`,
].join(' ')
].join(' '),
)
}

Expand All @@ -150,7 +150,7 @@ function warnings ({ leadingLocale, followerLocales }) {
`${chalk.cyan(name)} locale has excess string:`,
`'${chalk.yellow(key)}' that is not present`,
`in ${chalk.cyan(leadingLocaleName)}.`,
].join(' ')
].join(' '),
)
}
}
Expand Down