fix: order imports and remove circular dependencies (#41824)
* fix: remove circular dependency redux depended on templates/Challenges/redux and vice versa. This meant that import order mattered and confusing bugs could arise. (cherry picked from commit 7d67a4e70922bbb3051f2f9982dcc69e240d43dc) * feat: require imports to be in alphabetical order Import order generally does not matter, but there are edge cases (circular imports and css imports, for example) where changing order changes behaviour (cherry picked from commit b8d1393a91ec6e068caf8e8498a5c95df68c2b2c) * chore: order imports * fix: lift up challenge description + title comps This brings the classic Show closer to the others as they now all create the description and title components * fix: remove donation-saga/index circular import (cherry picked from commit 51a44ca668a700786d2744feffeae4fdba5fd207) * refactor: extract action-types from settings (cherry picked from commit 25e26124d691c84a0d0827d41dafb761c686fadd) * fix: lint errors * feat: prevent useless renames
This commit is contained in:
committed by
GitHub
parent
c7b27a53e7
commit
e118dda13a
@@ -1,7 +1,7 @@
|
||||
const { getProjectPath } = require('./helpers/get-project-path');
|
||||
const {
|
||||
getLastStepFileContent
|
||||
} = require('./helpers/get-last-step-file-content');
|
||||
const { getProjectPath } = require('./helpers/get-project-path');
|
||||
const { reorderSteps, createStepFile } = require('./utils');
|
||||
|
||||
const projectPath = getProjectPath();
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import fs from 'fs/promises';
|
||||
import { existsSync } from 'fs';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { format } from 'prettier';
|
||||
import { prompt } from 'inquirer';
|
||||
import { format } from 'prettier';
|
||||
|
||||
import { createStepFile } from './utils.js';
|
||||
import { blockNameify } from '../../utils/block-nameify';
|
||||
import { createStepFile } from './utils.js';
|
||||
|
||||
const superBlocks = [
|
||||
'responsive-web-design',
|
||||
|
@@ -1,14 +1,14 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const matter = require('gray-matter');
|
||||
const ObjectID = require('bson-objectid');
|
||||
const { parseMDSync } = require('../challenge-parser/parser');
|
||||
const matter = require('gray-matter');
|
||||
const {
|
||||
getMetaData
|
||||
} = require('../challenge-helper-scripts/helpers/get-project-path-metadata');
|
||||
const { getStepTemplate } = require('./helpers/get-step-template');
|
||||
const { parseMDSync } = require('../challenge-parser/parser');
|
||||
const { getProjectMetaPath } = require('./helpers/get-project-meta-path');
|
||||
const { getProjectPath } = require('./helpers/get-project-path');
|
||||
const { getStepTemplate } = require('./helpers/get-step-template');
|
||||
const { padWithLeadingZeros } = require('./helpers/pad-with-leading-zeros');
|
||||
|
||||
const createStepFile = ({
|
||||
|
@@ -1,6 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const mock = require('mock-fs');
|
||||
const ObjectID = require('bson-objectid');
|
||||
const glob = require('glob');
|
||||
const mock = require('mock-fs');
|
||||
|
||||
// NOTE:
|
||||
// Use `console.log()` before mocking the filesystem or use
|
||||
@@ -48,7 +49,6 @@ jest.mock(
|
||||
);
|
||||
|
||||
const mockChallengeId = '60d35cf3fe32df2ce8e31b03';
|
||||
const ObjectID = require('bson-objectid');
|
||||
const { getStepTemplate } = require('./helpers/get-step-template');
|
||||
const { createStepFile, reorderSteps } = require('./utils');
|
||||
|
||||
|
@@ -1,17 +1,17 @@
|
||||
const { readSync } = require('to-vfile');
|
||||
const remark = require('remark-parse');
|
||||
const directive = require('remark-directive');
|
||||
const frontmatter = require('remark-frontmatter');
|
||||
const addTests = require('./plugins/add-tests');
|
||||
const restoreDirectives = require('./plugins/restore-directives');
|
||||
const replaceImports = require('./plugins/replace-imports');
|
||||
const remark = require('remark-parse');
|
||||
const { readSync } = require('to-vfile');
|
||||
const unified = require('unified');
|
||||
const addFrontmatter = require('./plugins/add-frontmatter');
|
||||
const addText = require('./plugins/add-text');
|
||||
const addVideoQuestion = require('./plugins/add-video-question');
|
||||
const addSeed = require('./plugins/add-seed');
|
||||
const addSolution = require('./plugins/add-solution');
|
||||
const addTests = require('./plugins/add-tests');
|
||||
const addText = require('./plugins/add-text');
|
||||
const addVideoQuestion = require('./plugins/add-video-question');
|
||||
const replaceImports = require('./plugins/replace-imports');
|
||||
const restoreDirectives = require('./plugins/restore-directives');
|
||||
const tableAndStrikeThrough = require('./plugins/table-and-strikethrough');
|
||||
const unified = require('unified');
|
||||
|
||||
// by convention, anything that adds to file.data has the name add<name>.
|
||||
const processor = unified()
|
||||
|
@@ -1,5 +1,5 @@
|
||||
const visit = require('unist-util-visit');
|
||||
const YAML = require('js-yaml');
|
||||
const visit = require('unist-util-visit');
|
||||
|
||||
function plugin() {
|
||||
return transformer;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
const { isEmpty } = require('lodash');
|
||||
const { root } = require('mdast-builder');
|
||||
const visitChildren = require('unist-util-visit-children');
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
// const visit = require('unist-util-visit');
|
||||
const visitChildren = require('unist-util-visit-children');
|
||||
const { root } = require('mdast-builder');
|
||||
const { getFileVisitor } = require('./utils/get-file-visitor');
|
||||
const { isEmpty } = require('lodash');
|
||||
|
||||
const editableRegionMarker = '--fcc-editable-region--';
|
||||
|
||||
|
@@ -1,24 +1,24 @@
|
||||
const { isObject } = require('lodash');
|
||||
const isArray = require('lodash/isArray');
|
||||
|
||||
const simpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const withEditableAST = require('../__fixtures__/ast-with-markers.json');
|
||||
const withSeedKeysAST = require('../__fixtures__/ast-seed-keys.json');
|
||||
const withExtraLinesAST = require('../__fixtures__/ast-with-extra-lines.json');
|
||||
const orphanKeyAST = require('../__fixtures__/ast-orphan-key.json');
|
||||
const adjacentKeysAST = require('../__fixtures__/ast-adjacent-keys.json');
|
||||
const withBeforeAfterAST = require('../__fixtures__/ast-before-after.json');
|
||||
const emptyBeforeAST = require('../__fixtures__/ast-empty-before.json');
|
||||
const cCodeAST = require('../__fixtures__/ast-c-code.json');
|
||||
const doubleMarkerAST = require('../__fixtures__/ast-double-marker.json');
|
||||
const emptyAfterAST = require('../__fixtures__/ast-empty-after.json');
|
||||
const emptyBeforeAST = require('../__fixtures__/ast-empty-before.json');
|
||||
const emptyContentAST = require('../__fixtures__/ast-empty-contents.json');
|
||||
const emptyCSSAST = require('../__fixtures__/ast-empty-css.json');
|
||||
const emptyHTMLAST = require('../__fixtures__/ast-empty-html.json');
|
||||
const doubleMarkerAST = require('../__fixtures__/ast-double-marker.json');
|
||||
const jsxSeedAST = require('../__fixtures__/ast-jsx-seed.json');
|
||||
const cCodeAST = require('../__fixtures__/ast-c-code.json');
|
||||
const explodedMarkerAST = require('../__fixtures__/ast-exploded-marker.json');
|
||||
const emptyContentAST = require('../__fixtures__/ast-empty-contents.json');
|
||||
const jsxSeedAST = require('../__fixtures__/ast-jsx-seed.json');
|
||||
const orphanKeyAST = require('../__fixtures__/ast-orphan-key.json');
|
||||
const withSeedKeysAST = require('../__fixtures__/ast-seed-keys.json');
|
||||
const simpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const withExtraLinesAST = require('../__fixtures__/ast-with-extra-lines.json');
|
||||
const withEditableAST = require('../__fixtures__/ast-with-markers.json');
|
||||
|
||||
const addSeed = require('./add-seed');
|
||||
const { isObject } = require('lodash');
|
||||
|
||||
describe('add-seed plugin', () => {
|
||||
const plugin = addSeed();
|
||||
|
@@ -1,10 +1,10 @@
|
||||
const visitChildren = require('unist-util-visit-children');
|
||||
const { root } = require('mdast-builder');
|
||||
const visitChildren = require('unist-util-visit-children');
|
||||
|
||||
const { editableRegionMarker } = require('./add-seed');
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
const { getFileVisitor } = require('./utils/get-file-visitor');
|
||||
const { splitOnThematicBreak } = require('./utils/split-on-thematic-break');
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
const { editableRegionMarker } = require('./add-seed');
|
||||
|
||||
function validateMarkers({ value }) {
|
||||
const lines = value.split('\n');
|
||||
|
@@ -1,9 +1,9 @@
|
||||
const mockAST = require('../__fixtures__/ast-simple.json');
|
||||
const { isObject } = require('lodash');
|
||||
const editableSolutionAST = require('../__fixtures__/ast-erm-in-solution.json');
|
||||
const multiSolnsAST = require('../__fixtures__/ast-multiple-solutions.json');
|
||||
const mockAST = require('../__fixtures__/ast-simple.json');
|
||||
|
||||
const addSolution = require('./add-solution');
|
||||
const { isObject } = require('lodash');
|
||||
|
||||
describe('add solution plugin', () => {
|
||||
const plugin = addSolution();
|
||||
|
@@ -1,5 +1,5 @@
|
||||
const simpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const brokenHintsAST = require('../__fixtures__/ast-broken-hints.json');
|
||||
const simpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const addTests = require('./add-tests');
|
||||
|
||||
describe('add-tests plugin', () => {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const mockAST = require('../__fixtures__/ast-simple.json');
|
||||
// eslint-disable-next-line max-len
|
||||
const incorrectMarkersAST = require('../__fixtures__/ast-incorrect-markers.json');
|
||||
const realisticAST = require('../__fixtures__/ast-realistic.json');
|
||||
const mockAST = require('../__fixtures__/ast-simple.json');
|
||||
const addText = require('./add-text');
|
||||
|
||||
describe('add-text', () => {
|
||||
|
@@ -1,11 +1,11 @@
|
||||
const path = require('path');
|
||||
const { isEmpty } = require('lodash');
|
||||
const remark = require('remark');
|
||||
const { read } = require('to-vfile');
|
||||
const modifyChildren = require('unist-util-modify-children');
|
||||
const remark = require('remark');
|
||||
const remove = require('unist-util-remove');
|
||||
const visit = require('unist-util-visit');
|
||||
const { selectAll } = require('unist-util-select');
|
||||
const { isEmpty } = require('lodash');
|
||||
const visit = require('unist-util-visit');
|
||||
|
||||
const { editableRegionMarker } = require('./add-seed');
|
||||
const tableAndStrikeThrough = require('./table-and-strikethrough');
|
||||
|
@@ -3,12 +3,12 @@ const cloneDeep = require('lodash/cloneDeep');
|
||||
const toVfile = require('to-vfile');
|
||||
const selectAll = require('unist-util-select').selectAll;
|
||||
|
||||
const addImports = require('./replace-imports');
|
||||
const originalImportsAST = require('../__fixtures__/ast-imports.json');
|
||||
const originalImportsTwoAST = require('../__fixtures__/ast-imports-two.json');
|
||||
const originalImportsExtraAST = require('../__fixtures__/ast-imports-extra.json');
|
||||
const originalSimpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const originalImportsTwoAST = require('../__fixtures__/ast-imports-two.json');
|
||||
const originalImportsAST = require('../__fixtures__/ast-imports.json');
|
||||
const originalMarkerAST = require('../__fixtures__/ast-marker-imports.json');
|
||||
const originalSimpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const addImports = require('./replace-imports');
|
||||
|
||||
describe('replace-imports', () => {
|
||||
let importsAST;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const visit = require('unist-util-visit');
|
||||
const { matches } = require('unist-util-select');
|
||||
const directive = require('mdast-util-directive');
|
||||
var toMarkdown = require('mdast-util-to-markdown');
|
||||
const { matches } = require('unist-util-select');
|
||||
const visit = require('unist-util-visit');
|
||||
|
||||
function plugin() {
|
||||
return transformer;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
const cloneDeep = require('lodash/cloneDeep');
|
||||
const { selectAll } = require('unist-util-select');
|
||||
const find = require('unist-util-find');
|
||||
const { selectAll } = require('unist-util-select');
|
||||
|
||||
const restoreDirectives = require('./restore-directives');
|
||||
const directivesOriginalAST = require('../__fixtures__/ast-directives.json');
|
||||
const restoreDirectives = require('./restore-directives');
|
||||
|
||||
describe('restore-directives', () => {
|
||||
let directivesAST;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var fromMarkdown = require('mdast-util-gfm/from-markdown');
|
||||
var strikethrough = require('micromark-extension-gfm-strikethrough');
|
||||
var table = require('micromark-extension-gfm-table');
|
||||
var fromMarkdown = require('mdast-util-gfm/from-markdown');
|
||||
|
||||
module.exports = tableAndStrikethrough;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const between = require('unist-util-find-all-between');
|
||||
const find = require('unist-util-find');
|
||||
const findAfter = require('unist-util-find-after');
|
||||
const findAllAfter = require('unist-util-find-all-after');
|
||||
const between = require('unist-util-find-all-between');
|
||||
|
||||
function getAllBetween(tree, marker) {
|
||||
const start = find(tree, {
|
||||
|
@@ -1,10 +1,10 @@
|
||||
const isArray = require('lodash/isArray');
|
||||
const find = require('unist-util-find');
|
||||
const { root } = require('mdast-builder');
|
||||
const find = require('unist-util-find');
|
||||
|
||||
const getAllBetween = require('./between-headings');
|
||||
const simpleAst = require('../../__fixtures__/ast-simple.json');
|
||||
const extraHeadingAst = require('../../__fixtures__/ast-extra-heading.json');
|
||||
const simpleAst = require('../../__fixtures__/ast-simple.json');
|
||||
const getAllBetween = require('./between-headings');
|
||||
|
||||
describe('between-headings', () => {
|
||||
it('should return an array', () => {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
const { isEmpty } = require('lodash');
|
||||
const is = require('unist-util-is');
|
||||
const position = require('unist-util-position');
|
||||
const { isEmpty } = require('lodash');
|
||||
|
||||
const getId = require('./get-id');
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
const getId = require('./get-id');
|
||||
const idNode = require('./__fixtures__/id-node.json');
|
||||
const imageNode = require('./__fixtures__/image-node.json');
|
||||
const multipleChildrenNode = require('./__fixtures__/multiple-children.json');
|
||||
const nonIdNode = require('./__fixtures__/non-id-node.json');
|
||||
const getId = require('./get-id');
|
||||
|
||||
describe('get-id', () => {
|
||||
it('should return a string', () => {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
const hastToHTML = require('hast-util-to-html');
|
||||
const mdastToHast = require('mdast-util-to-hast');
|
||||
const { root } = require('mdast-builder');
|
||||
const mdastToHast = require('mdast-util-to-hast');
|
||||
|
||||
function mdastToHTML(nodes) {
|
||||
if (!Array.isArray(nodes))
|
||||
|
@@ -1,8 +1,8 @@
|
||||
const mdastToHTML = require('./mdast-to-html');
|
||||
const leadingInlineHTMLNode = require('./__fixtures__/leading-html-node.json');
|
||||
const mdastMixedNodes = require('./__fixtures__/mdast-mixed-nodes.json');
|
||||
const mdastWithEmNode = require('./__fixtures__/mdast-with-em.json');
|
||||
const singleNode = require('./__fixtures__/non-id-node.json');
|
||||
const leadingInlineHTMLNode = require('./__fixtures__/leading-html-node.json');
|
||||
const mdastToHTML = require('./mdast-to-html');
|
||||
|
||||
describe('mdast-to-html', () => {
|
||||
it('should return a string', () => {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
const { inspect } = require('util');
|
||||
const path = require('path');
|
||||
const { inspect } = require('util');
|
||||
|
||||
const { parseMD } = require('../index');
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const { read } = require('to-vfile');
|
||||
const remark = require('remark');
|
||||
const directive = require('remark-directive');
|
||||
const frontmatter = require('remark-frontmatter');
|
||||
const { read } = require('to-vfile');
|
||||
|
||||
(async () => {
|
||||
const path = './example.md';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const { read } = require('to-vfile');
|
||||
const { inspect } = require('util');
|
||||
const remark = require('remark');
|
||||
const html = require('remark-html');
|
||||
const { inspect } = require('util');
|
||||
const { read } = require('to-vfile');
|
||||
|
||||
(async () => {
|
||||
const path = './example.md';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const { read } = require('to-vfile');
|
||||
const remark = require('remark');
|
||||
const directives = require('remark-directive');
|
||||
const stringify = require('remark-stringify');
|
||||
const { read } = require('to-vfile');
|
||||
|
||||
(async () => {
|
||||
const path = './example.md';
|
||||
|
@@ -1,12 +1,12 @@
|
||||
const {
|
||||
ENGLISH_CHALLENGE_NO_FILES
|
||||
} = require('./__fixtures__/challenge-objects');
|
||||
const { SIMPLE_TRANSLATION } = require('./__mocks__/mock-comments');
|
||||
const {
|
||||
translateComments,
|
||||
translateCommentsInChallenge,
|
||||
translateGeneric
|
||||
} = require('.');
|
||||
const {
|
||||
ENGLISH_CHALLENGE_NO_FILES
|
||||
} = require('./__fixtures__/challenge-objects');
|
||||
const { SIMPLE_TRANSLATION } = require('./__mocks__/mock-comments');
|
||||
|
||||
let logSpy;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable import/no-unresolved */
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const opencc = require('node-opencc');
|
||||
|
||||
const getFiles = async (directory, fileList = []) => {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
require('dotenv').config({ path: `${__dirname}/../../.env` });
|
||||
const core = require('@actions/core');
|
||||
const { getFiles } = require('../../utils/files');
|
||||
const { getStrings, changeHiddenStatus } = require('../../utils/strings');
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
const core = require('@actions/core');
|
||||
|
||||
const filename = core.getInput('filename');
|
||||
const stringContent = core.getInput('string-content');
|
||||
|
@@ -1,6 +1,6 @@
|
||||
const makeRequest = require('./make-request');
|
||||
const delay = require('./delay');
|
||||
const authHeader = require('./auth-header');
|
||||
const delay = require('./delay');
|
||||
const makeRequest = require('./make-request');
|
||||
|
||||
const getDirs = async projectId => {
|
||||
let headers = { ...authHeader };
|
||||
|
@@ -1,5 +1,5 @@
|
||||
const makeRequest = require('./make-request');
|
||||
const authHeader = require('./auth-header');
|
||||
const makeRequest = require('./make-request');
|
||||
|
||||
const addFile = async (projectId, filename, fileContent, directoryId) => {
|
||||
let headers = { ...authHeader };
|
||||
|
@@ -1,5 +1,5 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const { getChallengesForLang } = require('../../../curriculum/getChallenges');
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const env = require('../../../config/read-env');
|
||||
const { availableLangs } = require('../../../config/i18n/all-langs');
|
||||
const env = require('../../../config/read-env');
|
||||
|
||||
const globalConfigPath = path.resolve(__dirname, '../../../config');
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
const YAML = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const YAML = require('js-yaml');
|
||||
const argv = require('yargs').argv;
|
||||
const linter = require('./linter');
|
||||
|
||||
|
@@ -1,18 +1,15 @@
|
||||
const fullyCertifiedUser = require('./certifiedUserData');
|
||||
|
||||
const path = require('path');
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') });
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const ObjectId = require('mongodb').ObjectID;
|
||||
const debug = require('debug');
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') });
|
||||
const { MongoClient, ObjectId } = require('mongodb');
|
||||
const defaultUserImage = require('../../../config/misc').defaultUserImage;
|
||||
const fullyCertifiedUser = require('./certifiedUserData');
|
||||
|
||||
const envVariables = process.argv;
|
||||
|
||||
const log = debug('fcc:tools:seedLocalAuthUser');
|
||||
const { MONGOHQ_URL } = process.env;
|
||||
|
||||
const defaultUserImage = require('../../../config/misc').defaultUserImage;
|
||||
|
||||
function handleError(err, client) {
|
||||
if (err) {
|
||||
console.error('Oh noes!! Error seeding local auth user.');
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
import babel from '@rollup/plugin-babel';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
|
||||
const production = process.env.NODE_ENV !== 'development';
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
import './button.css';
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { Button } from './button';
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
import colorList from './colors.css';
|
||||
|
||||
|
Reference in New Issue
Block a user