Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"files": [
"babel.config.js",
"gulpfile.js",
"jest.config.js",
"karma.conf.js",
"script/*.js",
"webpack.config.js"
Expand All @@ -55,6 +56,12 @@
},
"rules": {
"import/no-commonjs": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
],
"import/no-nodejs-modules": "off",
"lodash/import-scope": ["warn", "method-package"]
},
Expand All @@ -74,6 +81,12 @@
"jest-setup.js"
],
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
],
"jest/no-alias-methods": "warn",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "warn",
Expand Down Expand Up @@ -108,27 +121,24 @@
}
}
},
{
"files": "src/**/*",
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": false
}
]
}
},
{
"files": "src/sagas/**/*",
"rules": {
"import/order": "off"
}
},
{
"files": "test/unit/**/*",
"files": "test/**/*",
"globals": {
"sinon": true
},
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
]
}
},
{
Expand Down Expand Up @@ -206,7 +216,12 @@
],
"import/no-commonjs": "warn",
"import/no-cycle": "error",
"import/no-extraneous-dependencies": "error",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": false
}
],
"import/no-mutable-exports": "warn",
"import/no-named-default": "warn",
"import/no-namespace": "warn",
Expand All @@ -222,6 +237,7 @@
{
"allow": [
"brace/**/*",
"codemirror/{addon,mode}/**/*",
"core-js",
"es6-set/implement",
"firebase/*",
Expand Down Expand Up @@ -277,7 +293,7 @@
"new-cap": [
"warn",
{
"capIsNewExceptions": ["Slowparse.HTML", "Record"]
"capIsNewExceptions": ["CodeMirror", "Slowparse.HTML", "Record"]
}
],
"no-alert": "warn",
Expand Down
5 changes: 3 additions & 2 deletions .renovaterc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"eslint-plugin-prettier",
"eslint-plugin-private-props",
"eslint-plugin-promise",
"eslint-plugin-react"
"eslint-plugin-react",
"eslint-plugin-react-hooks"
]
},
{
Expand All @@ -60,7 +61,6 @@
"automerge": true,
"packageNames": ["jest", "jest-extended"]
},

{
"groupName": "Karma",
"automerge": true,
Expand Down Expand Up @@ -167,6 +167,7 @@
"jscodeshift",
"prettier",
"sinon",
"react-test-renderer",
"rosie",
"yarn-deduplicate"
],
Expand Down
15 changes: 15 additions & 0 deletions __factories__/packages/codemirror.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {Factory} from 'rosie';

export const position = new Factory().attrs({
line: 0,
ch: 0,
});

export const change = new Factory()
.attr('from', () => position.build())
.attr('to', () => position.build())
.attrs({
text: 'c',
removed: '',
origin: '+input',
});
14 changes: 14 additions & 0 deletions __factories__/records/Error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {List} from 'immutable';
import {Factory} from 'rosie';

import Error from '../../src/records/Error';

export const errorFactory = new Factory(Error).attrs({
row: 3,
column: 2,
reason: 'bad-code',
payload: {},
suppresses: new List(),
text: 'Bad code',
raw: 'Bad code',
});
7 changes: 7 additions & 0 deletions __mocks__/bowser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import constant from 'lodash-es/constant';

export default {
getParser: constant({
isOS: jest.fn().mockReturnValue(false),
}),
};
21 changes: 21 additions & 0 deletions __mocks__/codemirror.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import assignIn from 'lodash-es/assignIn';
import tap from 'lodash-es/tap';

export const Doc = jest.fn(() => ({}));

export default tap(
jest.fn(() => ({
focus: jest.fn(),
getDoc: jest.fn().mockReturnValue({setCursor: jest.fn()}),
on: jest.fn(),
off: jest.fn(),
performLint: jest.fn(),
scrollIntoView: jest.fn(),
setOption: jest.fn(),
setSize: jest.fn(),
swapDoc: jest.fn(),
getValue: jest.fn().mockReturnValue(''),
setValue: jest.fn(),
})),
CodeMirror => assignIn(CodeMirror, {Doc}),
);
5 changes: 5 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const srcDir = 'src';
const distDir = 'dist';
const stylesheetsDir = path.join(srcDir, 'css');
const highlightStylesheetsDir = 'node_modules/highlight.js/styles';
const codemirrorStylesheets = [
'node_modules/codemirror/lib/codemirror.css',
'node_modules/codemirror/addon/lint/lint.css',
];
const staticDir = path.join(srcDir, 'static');
const bowerComponents = 'bower_components';

Expand Down Expand Up @@ -60,6 +64,7 @@ gulp.task('css', () => {
.src([
path.join(bowerComponents, 'normalize-css/normalize.css'),
path.join(highlightStylesheetsDir, 'github.css'),
...codemirrorStylesheets,
path.join(stylesheetsDir, '**/*.css'),
])
.pipe(concat('application.css'))
Expand Down
6 changes: 0 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/* eslint-env node */
/* eslint-disable import/no-commonjs */

// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
clearMocks: true,
moduleNameMapper: {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
"brace": "0.11.1",
"chrono-node": "1.3.11",
"classnames": "2.2.6",
"codemirror": "5.49.0",
"core-js": "3.5.0",
"css": "2.2.4",
"delay": "4.3.0",
Expand All @@ -233,6 +234,7 @@
"loadjs": "4.2.0",
"lodash-es": "4.17.15",
"loop-breaker": "0.1.1",
"lru-cache": "5.1.1",
"moment": "2.24.0",
"mousetrap": "1.6.3",
"object-inspect": "1.7.0",
Expand Down Expand Up @@ -373,6 +375,7 @@
"postcss-preset-env": "6.7.0",
"prettier": "1.19.1",
"raw-loader": "4.0.0",
"react-test-renderer": "16.10.2",
"redux-saga-test-plan": "4.0.0-rc.3",
"rosie": "2.0.1",
"script-ext-html-webpack-plugin": "2.1.4",
Expand Down
Loading