Skip to content

Commit

Permalink
Remove no-underscore-dangle eslint rule (keystonejs#388)
Browse files Browse the repository at this point in the history
* Remove no-underscore-dangle eslint rule

Closes keystonejs#387

* Remove eslint disable line comments for no-underscore-dangle
  • Loading branch information
emmatown authored Sep 27, 2018
1 parent f2b9545 commit 474e963
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 18 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module.exports = {
'no-shadow': 'warn',
'no-trailing-spaces': 'error',
'no-undef': 'error',
'no-underscore-dangle': 'error',
'no-unused-expressions': 'error',
'no-unused-vars': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/client/pages/Item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ const ItemDetails = withRouter(
<ClippyIcon />
);
const listHref = `${adminPath}/${list.path}`;
const titleText = item._label_; // eslint-disable-line no-underscore-dangle
const titleText = item._label_;
return (
<Fragment>
{updateErrorMessage ? (
Expand Down
2 changes: 0 additions & 2 deletions packages/core/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,6 @@ module.exports = class List {
}

async manyQuery(args, context, queryName) {
// eslint-disable-next-line no-underscore-dangle
return this._tryManyQuery(args, context, queryName, queryArgs =>
this.adapter.itemsQuery(queryArgs)
);
Expand All @@ -927,7 +926,6 @@ module.exports = class List {
// on what the user requested
// Evalutation takes place in ../Keystone/index.js
getCount: () => {
// eslint-disable-next-line no-underscore-dangle
return this._tryManyQuery(args, context, queryName, queryArgs =>
this.adapter.itemsQueryMeta(queryArgs).then(({ count }) => count)
);
Expand Down
1 change: 0 additions & 1 deletion packages/fields/tests/idFilterTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const getIDs = async keystone => {
.exec()
.then(data => {
data.forEach(entry => {
// eslint-disable-next-line no-underscore-dangle
IDs[entry.name] = entry._id.toString();
});
});
Expand Down
3 changes: 0 additions & 3 deletions packages/fields/types/Relationship/Implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class Relationship extends Implementation {
[this.path]: (item, _, context) => {
// The field may have already been filled in during an early DB lookup
// (ie; joining when doing a filter)
// eslint-disable-next-line no-underscore-dangle
const id = item[this.path] && item[this.path]._id ? item[this.path]._id : item[this.path];

if (!id) {
Expand All @@ -126,9 +125,7 @@ class Relationship extends Implementation {
.map(value => {
// The field may have already been filled in during an early DB lookup
// (ie; joining when doing a filter)
// eslint-disable-next-line no-underscore-dangle
if (value && value._id) {
// eslint-disable-next-line no-underscore-dangle
return value._id;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/fields/types/Relationship/views/Cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default ({ data, field, Link }) => {
<Fragment key={item.id}>
{!!index ? ', ' : ''}
<Link path={refList.path} id={item.id}>
{item._label_ /* eslint-disable-line no-underscore-dangle */}
{item._label_}
</Link>
</Fragment>
))}
Expand Down
2 changes: 1 addition & 1 deletion packages/fields/types/Relationship/views/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class RelationshipField extends Component {

const options = data[refList.gqlNames.listQueryName].map(listData => ({
value: pick(listData, ['id']),
label: listData._label_, // eslint-disable-line no-underscore-dangle
label: listData._label_,
}));

let value = null;
Expand Down
4 changes: 0 additions & 4 deletions packages/mongo-join-builder/tests/mongo-results.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ describe('Testing against real data', () => {
[table]: parentData[table].map(id => {
return (
parentData[keyOfRelationship].find(
// eslint-disable-next-line no-underscore-dangle
relatedItem => relatedItem._id.toString() === id.toString()
) || id
);
Expand Down Expand Up @@ -528,7 +527,6 @@ describe('Testing against real data', () => {
[table]: parentData[table].map(id => {
return (
parentData[keyOfRelationship].find(
// eslint-disable-next-line no-underscore-dangle
relatedItem => relatedItem._id.toString() === id.toString()
) || id
);
Expand Down Expand Up @@ -628,7 +626,6 @@ describe('Testing against real data', () => {
[table]: parentData[table].map(id => {
return (
parentData[keyOfRelationship].find(
// eslint-disable-next-line no-underscore-dangle
relatedItem => relatedItem._id.toString() === id.toString()
) || id
);
Expand Down Expand Up @@ -734,7 +731,6 @@ describe('Testing against real data', () => {
[table]: parentData[table].map(id => {
return (
parentData[keyOfRelationship].find(
// eslint-disable-next-line no-underscore-dangle
relatedItem => relatedItem._id.toString() === id.toString()
) || id
);
Expand Down
1 change: 0 additions & 1 deletion projects/access-control/cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module.exports = async (on, config) => {
if (error) {
return reject(error);
}
// eslint-disable-next-line no-underscore-dangle
resolve(items.map(item => Object.assign({}, item, { id: item._id })));
})
);
Expand Down
1 change: 0 additions & 1 deletion projects/access-control/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function graphqlOperation(type) {
// (process.env.NODE_ENV !== 'production'), so this may error at some
// point. If so, we need another way of attaching a global graphql query
// lib to the window from within the app for testing.
// eslint-disable-next-line no-underscore-dangle
win.__APOLLO_CLIENT__[type]({
[type === 'mutate' ? 'mutation' : type]: operation,
// Avoid anything which may be cached when loading the admin UI - we
Expand Down
1 change: 0 additions & 1 deletion projects/basic/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function graphqlOperation(type) {
// (process.env.NODE_ENV !== 'production'), so this may error at some
// point. If so, we need another way of attaching a global graphql query
// lib to the window from within the app for testing.
// eslint-disable-next-line no-underscore-dangle
win.__APOLLO_CLIENT__[type]({
[type === 'mutate' ? 'mutation' : type]: operation,
})
Expand Down
1 change: 0 additions & 1 deletion projects/login/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function graphqlOperation(type) {
// (process.env.NODE_ENV !== 'production'), so this may error at some
// point. If so, we need another way of attaching a global graphql query
// lib to the window from within the app for testing.
// eslint-disable-next-line no-underscore-dangle
win.__APOLLO_CLIENT__[type]({
[type === 'mutate' ? 'mutation' : type]: operation,
// Avoid anything which may be cached when loading the admin UI - we
Expand Down

0 comments on commit 474e963

Please sign in to comment.