Skip to content

Commit

Permalink
Update dependencies and re-structure the repo (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdpattern authored Jun 26, 2020
1 parent 7c0f802 commit ee96bcc
Show file tree
Hide file tree
Showing 10 changed files with 3,370 additions and 2,603 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ npm
dist
build
coverage
node_modules
node_modules
__mocks__
__snapshots__
45 changes: 45 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = (api, options, cwd) => {
api.assertVersion(7);

let caller = "";

api.caller((instance) => {
if (instance != null) {
caller = instance.name;
}

return true;
});

const env = api.env();
api.cache.using(() =>
JSON.stringify({
env,
caller,
cwd,
options,
NODE_ENV: process.env.NODE_ENV,
BABEL_ENV: process.env.BABEL_ENV
})
);

return {
presets: [
[
"@babel/preset-env",
{
forceAllTransforms: true,
targets: {
node: true
}
}
],
"@babel/preset-react"
],
plugins: [
"add-module-exports",
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-object-rest-spread"
]
};
};
45 changes: 45 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const prettier = require("./prettier.config");

module.exports = {
parser: "babel-eslint",
parserOptions: {
sourceType: "module"
},
extends: ["eslint:recommended", "plugin:react/recommended", "prettier"],
plugins: ["react", "jest", "json", "prettier", "filenames"],
env: {
es6: true,
node: true,
jest: true
},
rules: {
"semi": "error",
"require-jsdoc": "error",
"valid-jsdoc": [
"error",
{
preferType: {
any: "*",
Boolean: "boolean",
Number: "number",
Object: "object",
String: "string",
return: "returns"
},
requireReturnType: true,
requireParamDescription: true,
requireReturnDescription: true
}
],
"quotes": [
"error",
"double",
{
avoidEscape: true
}
],
"filenames/no-index": "off",
"filenames/match-exported": ["error", [null, "kebab", "camel"]],
"prettier/prettier": ["error", prettier]
}
};
15 changes: 15 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
moduleFileExtensions: ["js", "jsx"],
testMatch: ["**/specs/**/*[.-][Ss]pec{,s}.{j}s"],
rootDir: ".",
verbose: false,
resetMocks: true,
resetModules: true,
collectCoverageFrom: [
"src/*.js",
"!**/*.min.js",
"!**/static/**",
"!**/specs/**",
"!**/node_modules/**"
]
};
162 changes: 28 additions & 134 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,136 +29,52 @@
"build": "rimraf gatsby-ssr.js index.js && cross-env BABEL_ENV=production babel src --out-dir .",
"clean": "npx rimraf node_modules",
"format": "prettier --write ./{src,specs}/{,**}/*.js",
"lint": "eslint ./{src,specs}/{,**}/*.js",
"lint": "eslint ./{src,specs}/{,**}/*.js --config eslint.config.js",
"test": "jest",
"test:verbose": "jest --verbose",
"test:coverage": "jest --coverage --runInBand --no-cache",
"release": "yarn run build && ./node_modules/.bin/standard-version"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
"@babel/plugin-transform-runtime": "^7.5.5",
"babel-eslint": "^10.0.2",
"@babel/cli": "^7.10.3",
"@babel/core": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"@babel/preset-react": "^7.10.1",
"@babel/plugin-proposal-object-rest-spread": "^7.10.3",
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.3",
"babel-eslint": "^10.1.0",
"babel-plugin-add-module-exports": "^1.0.2",
"cross-env": "^5.2.0",
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"cross-env": "^7.0.2",
"eslint": "^7.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-jest": "^22.13.0",
"eslint-plugin-json": "^1.4.0",
"eslint-plugin-prettier": "^3.1.0",
"husky": "^3.0.1",
"jest": "^24.8.0",
"lint-staged": "^9.2.0",
"prettier": "^1.18.2",
"react": "^16.8.6",
"remark": "^11.0.0",
"rimraf": "^2.6.2",
"standard-version": "^6.0.1"
"eslint-plugin-jest": "^23.17.1",
"eslint-plugin-json": "^2.1.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"husky": "^4.2.5",
"jest": "^26.1.0",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5",
"react": "^16.13.1",
"remark": "^12.0.0",
"rimraf": "^3.0.2",
"standard-version": "^8.0.0"
},
"dependencies": {
"@babel/runtime": "^7.5.5",
"@babel/runtime": "^7.10.3",
"async-unist-util-visit": "^1.0.0",
"cheerio": "^1.0.0-rc.3",
"parse-numeric-range": "^0.0.2",
"request": "^2.88.0",
"request-promise": "^4.2.4"
"parse-numeric-range": "^1.2.0",
"request": "^2.88.2",
"request-promise": "^4.2.5"
},
"peerDependencies": {
"gatsby": "*",
"gatsby-transformer-remark": "*",
"react": "*"
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"forceAllTransforms": true,
"targets": {
"node": true
}
}
],
"@babel/preset-react"
],
"plugins": [
"add-module-exports",
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-object-rest-spread"
]
},
"eslintConfig": {
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
},
"extends": [
"eslint:recommended",
"prettier"
],
"plugins": [
"jest",
"json",
"prettier",
"filenames"
],
"env": {
"es6": true,
"node": true,
"jest": true
},
"rules": {
"semi": "error",
"no-undef": "off",
"no-unused-vars": "off",
"no-dupe-class-members": "off",
"require-jsdoc": "error",
"valid-jsdoc": [
"error",
{
"preferType": {
"any": "*",
"Boolean": "boolean",
"Number": "number",
"Object": "object",
"String": "string",
"return": "returns"
},
"requireReturnType": true,
"requireParamDescription": true,
"requireReturnDescription": true
}
],
"quotes": [
"error",
"double",
{
"avoidEscape": true
}
],
"no-console": "off",
"filenames/no-index": "off",
"filenames/match-exported": [
"error",
[
null,
"kebab",
"camel"
]
],
"jest/no-disabled-tests": "error",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/valid-expect": "error",
"prettier/prettier": "error"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && npm test"
Expand All @@ -169,27 +85,5 @@
"prettier --write",
"git add"
]
},
"jest": {
"moduleFileExtensions": [
"js",
"jsx",
"ts",
"tsx"
],
"testMatch": [
"**/specs/**/*[.-][Ss]pec{,s}.{j,t}s{,x}"
],
"rootDir": ".",
"verbose": false,
"resetMocks": true,
"resetModules": true,
"collectCoverageFrom": [
"src/*.{j,t}s{,x}",
"!**/*.min.js",
"!**/static/**",
"!**/specs/**",
"!**/node_modules/**"
]
}
}
17 changes: 17 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: false,
quoteProps: "consistent",
trailingComma: "none",
bracketSpacing: true,
arrowParens: "always",
insertPragma: false,
endOfLine: "lf",
proseWrap: "preserve",
htmlWhitespaceSensitivity: "css",
jsxSingleQuote: false,
jsxBracketSameLine: false
};
2 changes: 1 addition & 1 deletion specs/index.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jest.mock("request-promise");
import remark from "remark";
import plugin from "../src/index";

const getNodeContent = node => node.children[0].children[0];
const getNodeContent = (node) => node.children[0].children[0];

describe("gatsby-remark-embedded-gist", () => {
it("generates an embedded gist with username", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export function onRenderBody({ setHeadComponents }, options = {}) {
as="style"
href="https://github.githubassets.com/assets/gist-embed-b3b573358bfc66d89e1e95dbf8319c09.css"
key="gist-embeded-b3b573358bfc66d89e1e95dbf8319c09"
onload="this.onload=null;this.rel='stylesheet'"
onLoad="this.onload=null;this.rel='stylesheet'"
rel="preload"
/>,
<noscript>
<noscript key="gist-embeded-noscript-b3b573358bfc66d89e1e95dbf8319c09">
<link
href="https://github.githubassets.com/assets/gist-embed-b3b573358bfc66d89e1e95dbf8319c09.css"
key="gist-embeded-b3b573358bfc66d89e1e95dbf8319c09"
Expand Down
Loading

0 comments on commit ee96bcc

Please sign in to comment.