mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 09:31:43 -05:00
cleanup quotes and added rule to eslint
This commit is contained in:
parent
17f96712ff
commit
7dcd8fc6ac
9 changed files with 84 additions and 80 deletions
14
.eslintrc
14
.eslintrc
|
@ -34,6 +34,9 @@
|
|||
"no-await-in-loop": 1,
|
||||
"comma-dangle": 0,
|
||||
"key-spacing": 0,
|
||||
"meteor/audit-argument-checks": 0,
|
||||
"no-case-declarations": 0,
|
||||
"no-console": 1,
|
||||
"no-extra-boolean-cast": 0,
|
||||
"no-undef": 1,
|
||||
"no-unused-vars": [
|
||||
|
@ -44,11 +47,12 @@
|
|||
"varsIgnorePattern": "React|PropTypes|Component"
|
||||
}
|
||||
],
|
||||
"no-console": 1,
|
||||
"react/prop-types": 0,
|
||||
"meteor/audit-argument-checks": 0,
|
||||
"no-case-declarations": 0,
|
||||
"no-useless-escape": 0
|
||||
"no-useless-escape": 0,
|
||||
"quotes": [
|
||||
1,
|
||||
"single"
|
||||
],
|
||||
"react/prop-types": 0
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
|
|
|
@ -26,11 +26,11 @@ Child Props:
|
|||
|
||||
*/
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { graphql } from "react-apollo";
|
||||
import gql from "graphql-tag";
|
||||
import { createClientTemplate } from "meteor/vulcan:core";
|
||||
import { extractCollectionInfo, extractFragmentInfo } from "./handleOptions";
|
||||
import React, { Component } from 'react';
|
||||
import { graphql } from 'react-apollo';
|
||||
import gql from 'graphql-tag';
|
||||
import { createClientTemplate } from 'meteor/vulcan:core';
|
||||
import { extractCollectionInfo, extractFragmentInfo } from './handleOptions';
|
||||
|
||||
const withCreate = options => {
|
||||
const { collectionName, collection } = extractCollectionInfo(options);
|
||||
|
|
|
@ -26,11 +26,11 @@ Child Props:
|
|||
|
||||
*/
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { graphql } from "react-apollo";
|
||||
import gql from "graphql-tag";
|
||||
import { deleteClientTemplate } from "meteor/vulcan:core";
|
||||
import { extractCollectionInfo, extractFragmentInfo } from "./handleOptions";
|
||||
import React, { Component } from 'react';
|
||||
import { graphql } from 'react-apollo';
|
||||
import gql from 'graphql-tag';
|
||||
import { deleteClientTemplate } from 'meteor/vulcan:core';
|
||||
import { extractCollectionInfo, extractFragmentInfo } from './handleOptions';
|
||||
|
||||
const withDelete = options => {
|
||||
const { collectionName, collection } = extractCollectionInfo(options);
|
||||
|
|
|
@ -34,24 +34,24 @@ Terms object can have the following properties:
|
|||
|
||||
*/
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { withApollo, graphql } from "react-apollo";
|
||||
import gql from "graphql-tag";
|
||||
import update from "immutability-helper";
|
||||
import { getSetting, getFragment, getFragmentName, getCollection, Utils, multiClientTemplate } from "meteor/vulcan:lib";
|
||||
import Mingo from "mingo";
|
||||
import compose from "recompose/compose";
|
||||
import withState from "recompose/withState";
|
||||
import find from "lodash/find";
|
||||
import React, { Component } from 'react';
|
||||
import { withApollo, graphql } from 'react-apollo';
|
||||
import gql from 'graphql-tag';
|
||||
import update from 'immutability-helper';
|
||||
import { getSetting, Utils, multiClientTemplate } from 'meteor/vulcan:lib';
|
||||
import Mingo from 'mingo';
|
||||
import compose from 'recompose/compose';
|
||||
import withState from 'recompose/withState';
|
||||
import find from 'lodash/find';
|
||||
|
||||
import { extractCollectionInfo, extractFragmentInfo } from "./handleOptions";
|
||||
import { extractCollectionInfo, extractFragmentInfo } from './handleOptions';
|
||||
|
||||
export default function withMulti(options) {
|
||||
// console.log(options)
|
||||
|
||||
const {
|
||||
limit = 10,
|
||||
pollInterval = getSetting("pollInterval", 20000),
|
||||
pollInterval = getSetting('pollInterval', 20000),
|
||||
enableTotal = true,
|
||||
enableCache = false,
|
||||
extraQueries
|
||||
|
@ -74,7 +74,7 @@ export default function withMulti(options) {
|
|||
withApollo,
|
||||
|
||||
// wrap component with HoC that manages the terms object via its state
|
||||
withState("paginationTerms", "setPaginationTerms", props => {
|
||||
withState('paginationTerms', 'setPaginationTerms', props => {
|
||||
// get initial limit from props, or else options
|
||||
const paginationLimit = (props.terms && props.terms.limit) || limit;
|
||||
const paginationTerms = {
|
||||
|
@ -145,7 +145,7 @@ export default function withMulti(options) {
|
|||
loading = props.data.networkStatus === 1,
|
||||
loadingMore = props.data.networkStatus === 2,
|
||||
error = props.data.error,
|
||||
propertyName = options.propertyName || "results";
|
||||
propertyName = options.propertyName || 'results';
|
||||
|
||||
if (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
@ -169,11 +169,11 @@ export default function withMulti(options) {
|
|||
loadMore(providedTerms) {
|
||||
// if new terms are provided by presentational component use them, else default to incrementing current limit once
|
||||
const newTerms =
|
||||
typeof providedTerms === "undefined"
|
||||
typeof providedTerms === 'undefined'
|
||||
? {
|
||||
/*...props.ownProps.terms,*/ ...props.ownProps.paginationTerms,
|
||||
limit: results.length + props.ownProps.paginationTerms.itemsPerPage
|
||||
}
|
||||
limit: results.length + props.ownProps.paginationTerms.itemsPerPage
|
||||
}
|
||||
: providedTerms;
|
||||
|
||||
props.ownProps.setPaginationTerms(newTerms);
|
||||
|
@ -184,7 +184,7 @@ export default function withMulti(options) {
|
|||
loadMoreInc(providedTerms) {
|
||||
// get terms passed as argument or else just default to incrementing the offset
|
||||
const newTerms =
|
||||
typeof providedTerms === "undefined"
|
||||
typeof providedTerms === 'undefined'
|
||||
? { ...props.ownProps.terms, ...props.ownProps.paginationTerms, offset: results.length }
|
||||
: providedTerms;
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { graphql } from "react-apollo";
|
||||
import gql from "graphql-tag";
|
||||
import { getSetting, singleClientTemplate, Utils } from "meteor/vulcan:lib";
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { graphql } from 'react-apollo';
|
||||
import gql from 'graphql-tag';
|
||||
import { getSetting, singleClientTemplate, Utils } from 'meteor/vulcan:lib';
|
||||
|
||||
import { extractCollectionInfo, extractFragmentInfo } from "./handleOptions";
|
||||
import { extractCollectionInfo, extractFragmentInfo } from './handleOptions';
|
||||
|
||||
export default function withSingle(options) {
|
||||
const { pollInterval = getSetting("pollInterval", 20000), enableCache = false, extraQueries } = options;
|
||||
const { pollInterval = getSetting('pollInterval', 20000), enableCache = false, extraQueries } = options;
|
||||
|
||||
const { collectionName, collection } = extractCollectionInfo(options);
|
||||
const { fragmentName, fragment } = extractFragmentInfo(options, collectionName);
|
||||
|
@ -43,7 +43,7 @@ export default function withSingle(options) {
|
|||
props: returnedProps => {
|
||||
const { /* ownProps, */ data } = returnedProps;
|
||||
|
||||
const propertyName = options.propertyName || "document";
|
||||
const propertyName = options.propertyName || 'document';
|
||||
const props = {
|
||||
loading: data.loading,
|
||||
// document: Utils.convertDates(collection, data[singleResolverName]),
|
||||
|
|
|
@ -27,13 +27,13 @@ Child Props:
|
|||
|
||||
*/
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { graphql } from "react-apollo";
|
||||
import gql from "graphql-tag";
|
||||
import { updateClientTemplate } from "meteor/vulcan:lib";
|
||||
import clone from "lodash/clone";
|
||||
import React, { Component } from 'react';
|
||||
import { graphql } from 'react-apollo';
|
||||
import gql from 'graphql-tag';
|
||||
import { updateClientTemplate } from 'meteor/vulcan:lib';
|
||||
import clone from 'lodash/clone';
|
||||
|
||||
import { extractCollectionInfo, extractFragmentInfo } from "./handleOptions";
|
||||
import { extractCollectionInfo, extractFragmentInfo } from './handleOptions';
|
||||
|
||||
const withUpdate = options => {
|
||||
const { collectionName, collection } = extractCollectionInfo(options);
|
||||
|
|
|
@ -27,13 +27,13 @@ Child Props:
|
|||
|
||||
*/
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { graphql } from "react-apollo";
|
||||
import gql from "graphql-tag";
|
||||
import { upsertClientTemplate } from "meteor/vulcan:core";
|
||||
import clone from "lodash/clone";
|
||||
import React, { Component } from 'react';
|
||||
import { graphql } from 'react-apollo';
|
||||
import gql from 'graphql-tag';
|
||||
import { upsertClientTemplate } from 'meteor/vulcan:core';
|
||||
import clone from 'lodash/clone';
|
||||
|
||||
import { extractCollectionInfo, extractFragmentInfo } from "./handleOptions";
|
||||
import { extractCollectionInfo, extractFragmentInfo } from './handleOptions';
|
||||
|
||||
const withUpsert = options => {
|
||||
const { collectionName, collection } = extractCollectionInfo(options);
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
Package.describe({
|
||||
name: "vulcan:core",
|
||||
summary: "Vulcan core package",
|
||||
version: "1.12.3",
|
||||
git: "https://github.com/VulcanJS/Vulcan.git"
|
||||
name: 'vulcan:core',
|
||||
summary: 'Vulcan core package',
|
||||
version: '1.12.3',
|
||||
git: 'https://github.com/VulcanJS/Vulcan.git'
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom("1.6.1");
|
||||
Package.onUse(function (api) {
|
||||
api.versionsFrom('1.6.1');
|
||||
|
||||
api.use([
|
||||
"vulcan:lib@1.12.3",
|
||||
"vulcan:i18n@1.12.3",
|
||||
"vulcan:users@1.12.3",
|
||||
"vulcan:routing@1.12.3",
|
||||
"vulcan:debug@1.12.3"
|
||||
'vulcan:lib@1.12.3',
|
||||
'vulcan:i18n@1.12.3',
|
||||
'vulcan:users@1.12.3',
|
||||
'vulcan:routing@1.12.3',
|
||||
'vulcan:debug@1.12.3'
|
||||
]);
|
||||
|
||||
api.imply(["vulcan:lib@1.12.3"]);
|
||||
api.imply(['vulcan:lib@1.12.3']);
|
||||
|
||||
api.mainModule("lib/server/main.js", "server");
|
||||
api.mainModule("lib/client/main.js", "client");
|
||||
api.mainModule('lib/server/main.js', 'server');
|
||||
api.mainModule('lib/client/main.js', 'client');
|
||||
});
|
||||
|
||||
Package.onTest(function(api) {
|
||||
api.use(["ecmascript", "meteortesting:mocha", "vulcan:core"]);
|
||||
api.mainModule("./test/index.js");
|
||||
Package.onTest(function (api) {
|
||||
api.use(['ecmascript', 'meteortesting:mocha', 'vulcan:core']);
|
||||
api.mainModule('./test/index.js');
|
||||
});
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
import { extractCollectionInfo, extractFragmentInfo } from "../lib/modules/containers/handleOptions";
|
||||
import expect from "expect";
|
||||
import { extractCollectionInfo, extractFragmentInfo } from '../lib/modules/containers/handleOptions';
|
||||
import expect from 'expect';
|
||||
|
||||
describe("vulcan-core/containers", function() {
|
||||
describe("handleOptions", function() {
|
||||
const expectedCollectionName = "COLLECTION_NAME";
|
||||
describe('vulcan-core/containers', function () {
|
||||
describe('handleOptions', function () {
|
||||
const expectedCollectionName = 'COLLECTION_NAME';
|
||||
const expectedCollection = { options: { expectedCollectionName } };
|
||||
it("get collectionName from collection", function() {
|
||||
it('get collectionName from collection', function () {
|
||||
const options = { collection: expectedCollection };
|
||||
const { collection, collectionName } = extractCollectionInfo(options);
|
||||
expect(collection).toEqual(expectedCollection);
|
||||
expect(collectionName).toEqual(expectedCollectionName);
|
||||
});
|
||||
it("get collection from collectioName", function() {
|
||||
it('get collection from collectioName', function () {
|
||||
// MOCK getCollection
|
||||
const options = { collectionName: expectedCollectionName };
|
||||
const { collection, collectionName } = extractCollectionInfo(options);
|
||||
expect(collection).toEqual(expectedCollection);
|
||||
expect(collectionName).toEqual(expectedCollectionName);
|
||||
});
|
||||
const expectedFragmentName = "FRAGMENT_NAME";
|
||||
const expectedFragmentName = 'FRAGMENT_NAME';
|
||||
const expectedFragment = { definitions: [{ name: { value: expectedFragmentName } }] };
|
||||
it("get fragment from fragmentName", function() {
|
||||
it('get fragment from fragmentName', function () {
|
||||
// MOCK getCollection
|
||||
const options = { fragmentName: expectedFragmentName };
|
||||
const { fragment, fragmentName } = extractFragmentInfo(options);
|
||||
expect(fragment).toEqual(expectedFragment);
|
||||
expect(fragmentName).toEqual(expectedFragmentName);
|
||||
});
|
||||
it("get fragmentName from fragment", function() {
|
||||
it('get fragmentName from fragment', function () {
|
||||
const options = { fragment: expectedFragment };
|
||||
const { fragment, fragmentName } = extractFragmentInfo(options);
|
||||
expect(fragment).toEqual(expectedFragment);
|
||||
expect(fragmentName).toEqual(expectedFragmentName);
|
||||
});
|
||||
it("get fragmentName and fragment from collectionName", function() {
|
||||
it('get fragmentName and fragment from collectionName', function () {
|
||||
// if options does not contain fragment, we get the collection default fragment based on its name
|
||||
const options = {};
|
||||
const { fragment, fragmentName } = extractFragmentInfo(options, expectedCollectionName);
|
||||
|
|
Loading…
Add table
Reference in a new issue