mirror of
https://github.com/strapi/strapi.git
synced 2025-12-16 09:45:08 +00:00
Merge pull request #1085 from strapi/eslint-email-graphql
Eslint email graphql
This commit is contained in:
commit
30c21aef35
@ -17,16 +17,17 @@
|
||||
"build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"lint:back": "node ./node_modules/strapi-lint/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-lint/lib/internals/eslint/back/.eslintrc.json controllers config services",
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "npm run lint",
|
||||
"test": "npm run lint:back",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"sendmail": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.12"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.12",
|
||||
"strapi-lint": "3.0.0-alpha.12"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -12,7 +12,7 @@ const sendmail = require('sendmail')({
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
send: (options, cb) => {
|
||||
send: (options, cb) => { // eslint-disable-line no-unused-vars
|
||||
return new Promise((resolve, reject) => {
|
||||
// Default values.
|
||||
options = _.isObject(options) ? options : {};
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
"build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"lint:back": "node ./node_modules/strapi-lint/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-lint/lib/internals/eslint/back/.eslintrc.json controllers config services",
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "npm run lint"
|
||||
"test": "npm run lint:back"
|
||||
},
|
||||
"dependencies": {
|
||||
"apollo-server-koa": "^1.3.3",
|
||||
@ -30,6 +30,9 @@
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-lint": "3.0.0-alpha.12"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer",
|
||||
"email": "",
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
* @description: A set of functions similar to controller's actions to avoid code duplication.
|
||||
*/
|
||||
|
||||
const policyUtils = require('strapi-utils').policy;
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@ -15,6 +14,7 @@ const pluralize = require('pluralize');
|
||||
const graphql = require('graphql');
|
||||
const { makeExecutableSchema } = require('graphql-tools');
|
||||
const GraphQLJSON = require('graphql-type-json');
|
||||
const policyUtils = require('strapi-utils').policy;
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -31,7 +31,7 @@ module.exports = {
|
||||
// Try to add description for field.
|
||||
if (type === 'field') {
|
||||
return lines
|
||||
.map((line, index) => {
|
||||
.map(line => {
|
||||
if (['{', '}'].includes(line)) {
|
||||
return ``;
|
||||
}
|
||||
@ -88,14 +88,14 @@ module.exports = {
|
||||
}
|
||||
|
||||
return lines
|
||||
.map((line, index) => {
|
||||
if ([0, lines.length - 1].includes(index)) {
|
||||
return ``;
|
||||
}
|
||||
.map((line, index) => {
|
||||
if ([0, lines.length - 1].includes(index)) {
|
||||
return ``;
|
||||
}
|
||||
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
},
|
||||
|
||||
/**
|
||||
@ -181,14 +181,14 @@ module.exports = {
|
||||
model: name
|
||||
};
|
||||
|
||||
const queryOpts = plugin ? { source: plugin } : {};
|
||||
const queryOpts = plugin ? { source: plugin } : {}; // eslint-disable-line no-unused-vars
|
||||
|
||||
const model = plugin ?
|
||||
strapi.plugins[plugin].models[name]:
|
||||
strapi.models[name];
|
||||
|
||||
// Retrieve generic service from the Content Manager plugin.
|
||||
const resolvers = strapi.plugins['content-manager'].services['contentmanager'];
|
||||
const resolvers = strapi.plugins['content-manager'].services['contentmanager']; // eslint-disable-line no-unused-vars
|
||||
|
||||
// Extract custom resolver or type description.
|
||||
const { resolver: handler = {} } = _schema;
|
||||
@ -282,7 +282,7 @@ module.exports = {
|
||||
|
||||
// Return the controller.
|
||||
return controller(ctx, next);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Plural.
|
||||
@ -293,7 +293,7 @@ module.exports = {
|
||||
);
|
||||
|
||||
return controller(ctx, next);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
// The controller hasn't been found.
|
||||
@ -362,7 +362,7 @@ module.exports = {
|
||||
return values && values.toJSON ? values.toJSON() : values;
|
||||
}
|
||||
|
||||
return resolver.call(null, obj, options, context)
|
||||
return resolver.call(null, obj, options, context);
|
||||
}
|
||||
|
||||
// Resolver can be a promise.
|
||||
@ -412,10 +412,10 @@ module.exports = {
|
||||
});
|
||||
|
||||
Object.assign(acc.resolver[globalId], {
|
||||
created_at: (obj, options, context) => {
|
||||
created_at: (obj, options, context) => { // eslint-disable-line no-unused-vars
|
||||
return obj.createdAt || obj.created_at;
|
||||
},
|
||||
updated_at: (obj, options, context) => {
|
||||
updated_at: (obj, options, context) => { // eslint-disable-line no-unused-vars
|
||||
return obj.updatedAt || obj.updated_at;
|
||||
}
|
||||
});
|
||||
@ -440,7 +440,7 @@ module.exports = {
|
||||
attributes[`${association.alias}(sort: String, limit: Int, start: Int, where: JSON)`] = attributes[association.alias];
|
||||
|
||||
delete attributes[association.alias];
|
||||
})
|
||||
});
|
||||
|
||||
acc.definition += `${this.getDescription(type[globalId], model)}type ${globalId} {${this.formatGQL(attributes, type[globalId], model)}}\n\n`;
|
||||
|
||||
@ -499,7 +499,7 @@ module.exports = {
|
||||
case 'manyMorphToMany':
|
||||
case 'manyToManyMorph':
|
||||
return _.merge(acc.resolver[globalId], {
|
||||
[association.alias]: async (obj, options, context) => {
|
||||
[association.alias]: async (obj, options, context) => { // eslint-disable-line no-unused-vars
|
||||
const [ withRelated, withoutRelated ] = await Promise.all([
|
||||
resolvers.fetch({
|
||||
id: obj[model.primaryKey],
|
||||
@ -526,12 +526,11 @@ module.exports = {
|
||||
return entry[association.alias];
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
_.merge(acc.resolver[globalId], {
|
||||
[association.alias]: async (obj, options, context) => {
|
||||
[association.alias]: async (obj, options, context) => { // eslint-disable-line no-unused-vars
|
||||
// Construct parameters object to retrieve the correct related entries.
|
||||
const params = {
|
||||
model: association.model || association.collection,
|
||||
@ -565,7 +564,7 @@ module.exports = {
|
||||
queryOpts.skip = convertedParams.start;
|
||||
|
||||
switch (association.nature) {
|
||||
case 'manyToMany':
|
||||
case 'manyToMany': {
|
||||
const arrayOfIds = obj[association.alias].map(related => {
|
||||
return related[ref.primaryKey] || related;
|
||||
});
|
||||
@ -578,6 +577,7 @@ module.exports = {
|
||||
...where.where
|
||||
}).where;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Where.
|
||||
queryOpts.query = strapi.utils.models.convertParams(name, {
|
||||
@ -710,12 +710,12 @@ module.exports = {
|
||||
polymorphicDef: `union Morph = ${types.join(' | ')}`,
|
||||
polymorphicResolver: {
|
||||
Morph: {
|
||||
__resolveType(obj, context, info) {
|
||||
__resolveType(obj, context, info) { // eslint-disable-line no-unused-vars
|
||||
return obj.kind || obj._type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -119,6 +119,10 @@ shell.cd('../strapi');
|
||||
watcher('', 'npm install ../strapi-generate ../strapi-generate-admin ../strapi-generate-api ../strapi-generate-new ../strapi-generate-plugin ../strapi-generate-policy ../strapi-generate-service ../strapi-utils');
|
||||
watcher('📦 Linking strapi...', 'npm link');
|
||||
|
||||
shell.cd('../strapi-plugin-graphql');
|
||||
watcher('', 'npm install ../strapi-lint --no-optional');
|
||||
watcher('📦 Linking strapi-plugin-graphql...', 'npm link --no-optional', false);
|
||||
|
||||
// Upload plugins
|
||||
shell.cd('../strapi-upload-local');
|
||||
watcher('📦 Linking strapi-upload-local...', 'npm link --no-optional', false);
|
||||
@ -126,6 +130,7 @@ watcher('📦 Linking strapi-upload-local...', 'npm link --no-optional', false)
|
||||
// Plugins with admin
|
||||
shell.cd('../strapi-plugin-email');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
watcher('', 'npm install ../strapi-lint --no-optional');
|
||||
watcher('📦 Linking strapi-plugin-email...', 'npm link --no-optional', false);
|
||||
|
||||
shell.cd('../strapi-plugin-users-permissions');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user