Commit 9d346cb1 authored by Mickaël Bourgier's avatar Mickaël Bourgier
Browse files

Fix some files that were importing @webalt/react

parent bcc4a85d
import Color from 'color';
import multiplyUnit from '@webalt/react/utils/multiplyUnit';
import multiplyUnit from '../utils/multiplyUnit';
export default theme => ({
root: {
......
import multiplyUnit from '@webalt/react/utils/multiplyUnit';
import multiplyUnit from '../utils/multiplyUnit';
export default theme => ({
root: {
......
import fs from 'fs';
import glob from 'glob';
import path from 'path';
describe('@webalt/react', () => {
it('must not use "@webalt/react" in imports', () => {
const files = glob.sync(path.join(__dirname, './**/*.js'), {
ignore: ['**/demos/*.js', '**/*.test.js']
});
const regex = /^.+from\s*['"]@webalt\/react.+$/m;
files.forEach(file => {
const fileContent = fs.readFileSync(file).toString();
try {
expect(fileContent).not.toMatch(regex);
} catch (e) {
const errors = fileContent.split('\n').reduce((result, line, index) => {
const r = regex.exec(line);
if (r !== null) {
return [
...result,
`Line ${String(index + 1).padStart(2)} : ${r[0].trim()}`
];
}
return result;
}, []);
throw new Error(
`File "${file}" must not import "@webalt/react"\n\n` +
errors.join('\n'),
e
);
}
});
});
});
......@@ -3262,7 +3262,7 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.1.3:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.1.1, glob@^7.1.2:
glob@^7.1.1, glob@^7.1.2, glob@^7.1.4:
version "7.1.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
......
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