Commit 99f98755 authored by Albert Salim's avatar Albert Salim

Update eslintrc to ignore generated file imports

parent ff4773d4
/* eslint-disable import/no-commonjs */
/* eslint-disable import/no-extraneous-dependencies */
const Resolver = require('jest-resolve'); const Resolver = require('jest-resolve');
// Wrap jest default resolver to detect missing frontend fixtures. // Wrap jest default resolver to detect missing frontend fixtures.
module.exports = (request, options) => { module.exports = (request, options) => {
try { try {
return options.defaultResolver(request, options) return options.defaultResolver(request, options);
} catch (e) { } catch (e) {
if (Resolver.tryCastModuleNotFoundError(e) && request.match(/tmp\/tests\/frontend\/fixtures/)) { if (Resolver.tryCastModuleNotFoundError(e) && request.match(/tmp\/tests\/frontend\/fixtures/)) {
console.error('\x1b[1m\x1b[41m\x1b[30m %s \x1b[0m %s', '!', `Fixture file ${request} does not exist. Did you run bin/rake frontend:fixtures?`) /* eslint-disable no-console */
/* eslint-disable @gitlab/require-i18n-strings */
console.error(
'\x1b[1m\x1b[41m\x1b[30m %s \x1b[0m %s',
'!',
`Fixture file ${request} does not exist. Did you run bin/rake frontend:fixtures?`,
);
} }
throw e; throw e;
} }
......
...@@ -26,4 +26,9 @@ rules: ...@@ -26,4 +26,9 @@ rules:
- off - off
"@gitlab/no-global-event-off": "@gitlab/no-global-event-off":
- off - off
import/no-unresolved:
- error
# The test fixtures and graphql schema are dynamically generated in CI
# during the `frontend-fixtures` and `graphql-schema-dump` jobs.
# They may not be present during linting.
- ignore: ['^test_fixtures\/', 'tmp/tests/graphql/gitlab_schema.graphql']
import { secondsToHours } from '~/lib/utils/datetime_utility';
import freezePeriodsFixture from 'test_fixtures/api/freeze-periods/freeze_periods.json'; import freezePeriodsFixture from 'test_fixtures/api/freeze-periods/freeze_periods.json';
import timezoneDataFixture from 'test_fixtures/timezones/short.json'; import timezoneDataFixture from 'test_fixtures/timezones/short.json';
import { secondsToHours } from '~/lib/utils/datetime_utility';
export { freezePeriodsFixture, timezoneDataFixture }; export { freezePeriodsFixture, timezoneDataFixture };
......
import { buildSchema, graphql } from 'graphql'; import { buildSchema, graphql } from 'graphql';
import { memoize } from 'lodash'; import { memoize } from 'lodash';
// The graphql schema is dynamically generated in CI // eslint-disable-next-line global-require
// during the `graphql-schema-dump` job.
// eslint-disable-next-line global-require, import/no-unresolved
const getGraphqlSchema = () => require('../../../../tmp/tests/graphql/gitlab_schema.graphql'); const getGraphqlSchema = () => require('../../../../tmp/tests/graphql/gitlab_schema.graphql');
const graphqlResolvers = { const graphqlResolvers = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment