Skip to content

Commit

Permalink
Changed spaces
Browse files Browse the repository at this point in the history
Changed spaces before function argument parens
  • Loading branch information
jeffloop committed Oct 25, 2022
1 parent a820457 commit eb6f66c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
24 changes: 12 additions & 12 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports.createResolvers = async ({ cache, createResolvers }, pluginOptions) => {
const fileResolver = {
imageFile: {
type: `File`,
async resolve (source) {
async resolve(source) {
// Lookup the cached image node and return it
const cachedFile = await cache.get(source.id);
return cachedFile;
Expand All @@ -131,7 +131,7 @@ class Plugin {
this.authPromise = null;
}

async setOptions (options) {
async setOptions(options) {
const { url, dev, auth } = options;

if (isEmpty(url)) error('"url" must be defined');
Expand Down Expand Up @@ -184,7 +184,7 @@ class Plugin {
return this.authPromise;
}

getOptions () {
getOptions() {
const internalOptions = ['url', 'dev', 'auth', 'type'];
const gatsbyPluginOptions = Object.fromEntries(
Object.entries(this.options).flatMap(([key, value]) => (internalOptions.includes(key) ? [] : [[key, value]]))
Expand All @@ -200,7 +200,7 @@ class Plugin {
};
}

getOptionsSystem () {
getOptionsSystem() {
const options = this.getOptions();

return {
Expand All @@ -214,13 +214,13 @@ class Plugin {
/**
* Method to retrieve all of the images in directus.files
*/
async getAllImages () {
async getAllImages() {
const files = await this.directus.files.readByQuery({ limit: -1 });
const imageFiles = files.data.filter(file => file.type.indexOf('image') > -1);
return imageFiles;
}

async headers () {
async headers() {
let headers = {};
if (typeof this.options?.headers === 'object') {
Object.assign(headers, this.options.headers || {});
Expand All @@ -239,27 +239,27 @@ class Plugin {
}

class Log {
static log (level, message) {
static log(level, message) {
let color = level === 'error' ? 'red' : level === 'warning' ? 'yellow' : 'white';

// eslint-disable-next-line no-console
console.log(chalk.cyan('gatsby-source-directus'), ':', chalk[color](message));
}
static error (message) {
static error(message) {
Log.log('error', message);
}
static warning (message) {
static warning(message) {
Log.log('error', message);
}
}

function isEmpty (value) {
function isEmpty(value) {
if (value?.constructor === String) return value.length === 0;

return true;
}

function error (message) {
function error(message) {
Log.error(message);

const error = new Error(`gatsby-source-directus: ${message}`);
Expand All @@ -268,7 +268,7 @@ function error (message) {
throw error;
}

function warning (message) {
function warning(message) {
Log.warning(message);
}

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"bugs": {
"url": "https://github.com/directus/directus/issues"
},
"gitHead": "24621f3934dc77eb23441331040ed13c676ceffd"
"gitHead": "24621f3934dc77eb23441331040ed13c676ceffd",
"devDependencies": {
"eslint-config-prettier": "^8.5.0"
}
}

0 comments on commit eb6f66c

Please sign in to comment.