Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Chore: add build step to bundle client-side assets #588

Merged
merged 10 commits into from Jul 10, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions .babelrc
@@ -0,0 +1,11 @@
{
"presets": [
"@babel/preset-react",
["@babel/preset-env", {
"modules": false,
"targets": {
"browsers": ["last 3 versions"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we want to do for this? Relevant discussion: #543

Copy link
Member Author

@kaicataldo kaicataldo Jul 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want to think about this yet, we can also specify forceAllTransforms: true, and it will compile everything to be ES5-compatible.

}
}]
]
}
10 changes: 7 additions & 3 deletions .eslintignore
@@ -1,3 +1,7 @@
js/app/eslint.js
js/app/espree.js
js/app/parser/index.built.js
node_modules
vendor
_site
assets/build
src/js/eslint.js
src/js/espree.js
!.*.js
79 changes: 79 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,79 @@
"use strict";

module.exports = {
root: true,
extends: ["eslint"],
parserOptions: {
ecmaVersion: 2019
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd ideally like to start using ES2015+ features, but I do think it's important we stick to features available in Espree so that we can dogfood it in our site. Does limiting ourselves to features available in Espree (so, features that have reached stage 4 and are supported by the parser) sound like a good policy?

Copy link
Member Author

@kaicataldo kaicataldo Jul 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should document this in the README (and maybe also create a CONTRIBUTING.md document)

},
rules: {

// Disable eslint-plugin-node rules from eslint-config-eslint
"no-process-exit": "off",
"node/no-deprecated-api": "off",
"node/no-extraneous-require": "off",
"node/no-missing-require": "off",
"node/no-unpublished-bin": "off",
"node/no-unpublished-require": "off",
"node/no-unsupported-features/es-builtins": "off",
"node/no-unsupported-features/es-syntax": "off",
"node/no-unsupported-features/node-builtins": "off",
"node/process-exit-as-throw": "off",
"node/shebang": "off",
"node/no-extraneous-import": "off",
"node/no-missing-import": "off",
"node/no-unpublished-import": "off",

// Disable rules that the codebase doesn't currently follow.
"require-jsdoc": "off"
},
overrides: [
{
files: ["src/js/**/*.{js,jsx}"],
plugins: ["react", "jsx-a11y"],
extends: ["plugin:react/recommended", "plugin:jsx-a11y/recommended"],
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true
}
},
settings: {
react: {
version: "15.0.1"
}
},
rules: {

// Disable rules that the codebase doesn't currently follow.
// It might be a good idea to enable these in the future.
"jsx-a11y/no-onchange": "off",
"react/prop-types": "off"
}
},
{
files: ["assets/js/*.js"],
parserOptions: {
ecmaVersion: 5,
sourceType: "script"
}
},
{
files: ["assets/js/*.js", "src/js/**/*.{js,jsx}"],
env: {
browser: true,
node: false
},
rules: {

// Disable rules that assume an ES6 environment.
// This is not a complete list. More rules should be added as problems are encountered.
"no-var": "off",
"object-shorthand": "off",
"prefer-arrow-callback": "off",
"prefer-rest-params": "off",
"prefer-template": "off"
}
}
]
};
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
node_modules/
_site/
assets/build
Gemfile.lock
.jekyll-metadata
npm-debug.log
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -5,5 +5,8 @@ cache: bundler
branches:
only:
- master
before_install:
- nvm install 8
- npm install
script:
- bundle exec jekyll build
- npm run lint && npm run build
2 changes: 1 addition & 1 deletion 404.md
Expand Up @@ -3,7 +3,7 @@ title: 404
layout: doc
---

# 4![0](/img/logo.svg)4
# 4![0](/assets/img/logo.svg)4
{:.four-oh-four-header}
## Something’s missing
### [Go home](/) or [check out the rules](/docs/rules)?
Expand Down
3 changes: 2 additions & 1 deletion _config.dev.yml
Expand Up @@ -15,6 +15,7 @@ exclude:
- Gemfile.lock
- package.json
- node_modules
- src
Copy link
Member Author

@kaicataldo kaicataldo Jul 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's not ignoring assets/build, this ensures Jekyll waits to regenerate the site until after Webpack finishes and outputs the bundles (I don't think this really matters what order they run in, but this prevents Jekyll from regenerating the site when src files are edited and then once more when the bundles are outputted).

- sitemap.xml
- feed.xml
- docs/0.24.1
Expand All @@ -24,4 +25,4 @@ exclude:
- docs/2.13.1
- docs/3.0.0
- docs/4.0.0
- docs/5.0.0
- docs/5.0.0
9 changes: 4 additions & 5 deletions _config.yml
@@ -1,10 +1,9 @@
title: "ESLint - Pluggable JavaScript linter"
repository: "eslint/eslint.github.io"
exclude: [
'node_modules',
'bower_components',
'vendor'
]
exclude:
- node_modules
- src
- vendor
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the Travis CI build

description: "A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease."
permalink: /blog/:year/:month/:title
plugins:
Expand Down
4 changes: 2 additions & 2 deletions _includes/footer.html
Expand Up @@ -36,7 +36,7 @@
htmlClassList.add("js");
</script>
{% if page.homepage %}
<script src="{{ site.url }}/js/app/image-lazy-loader.js" defer></script>
<script src="{{ site.url }}/assets/js/image-lazy-loader.js" defer></script>
{% endif %}
<script>
document.addEventListener('DOMContentLoaded', function() {
Expand Down Expand Up @@ -110,7 +110,7 @@
</script>

{% if page.demopage %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.min.js" data-main="/js/app/demo/requireConfig" defer></script>
<script src="{{ site.url }}/assets/build/js/demo.js"></script>
{% endif %}
</body>
</html>
8 changes: 4 additions & 4 deletions _includes/header.html
Expand Up @@ -11,14 +11,14 @@
<meta property="og:site_name" content="{{ site.title }}">
<meta property="og:title" content="{{ page.title }}">
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
<meta property="og:image" content="{{ site.url }}/img/favicon.512x512.png">
<meta property="og:image" content="{{ site.url }}/assets/img/favicon.512x512.png">

<meta name="twitter:site" content="@geteslint">
<meta name="twitter:title" content="{{ page.title }}">
<meta name="twitter:description" content="{{ site.description }}">
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="{{ site.url }}/img/favicon.512x512.png">
<meta name="twitter:image" content="{{ site.url }}/assets/img/favicon.512x512.png">
{% if page.title != site.title %}
{% if page.title != "ESLint" %}
<title>{{ page.title }} - {{ site.title }}</title>
Expand All @@ -30,9 +30,9 @@
{% endif %}
<link rel="preconnect" href="https://www.google-analytics.com">
<link href="{{ site.url }}{{ page.url }}" rel="canonical" />
<link rel="stylesheet" href="{{ site.url }}/styles/main.css"/>
<link rel="stylesheet" href="{{ site.url }}/assets/build/styles/main.css"/>
<link rel='manifest' href='{{ site.url }}/manifest.json'>
<link rel="icon" href="{{ site.url }}/img/favicon.512x512.png">
<link rel="icon" href="{{ site.url }}/assets/img/favicon.512x512.png">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ site.url }}/feed.xml">
<!-- at the end of the HEAD -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
Expand Down
2 changes: 1 addition & 1 deletion _includes/menu.html
Expand Up @@ -2,7 +2,7 @@
<header class="navbar navbar-default navbar-demo navbar-fixed-top eslint-nav" id="top" role="banner">
<div class="container">

<a href="{{ site.url }}/" class="navbar-brand"><img alt="ESLint" src="{{ site.url }}/img/logo.svg" itemprop="image">ESLint</a>
<a href="{{ site.url }}/" class="navbar-brand"><img alt="ESLint" src="{{ site.url }}/assets/img/logo.svg" itemprop="image">ESLint</a>

<div class="eslint-navbar-toggles">
<button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#eslint-navbar" aria-controls="eslint-navbar" aria-expanded="false">
Expand Down
1 change: 0 additions & 1 deletion _layouts/demo.html
@@ -1,6 +1,5 @@
{% include header.html %}
{% include menu.html %}
<link rel="stylesheet" property="stylesheet" type="text/css" href="/styles/vendor/orion-built-editor.css" />
<main class="container">
{{ content }}
</main>
Expand Down
10 changes: 5 additions & 5 deletions _tools/fetch-sponsors.js
Expand Up @@ -30,7 +30,7 @@ const sponsors = {
backers: []
};

const graphqlEndpoint = 'https://api.opencollective.com/graphql/v2';
const graphqlEndpoint = "https://api.opencollective.com/graphql/v2";

const graphqlQuery = `{
account(slug: "eslint") {
Expand Down Expand Up @@ -65,9 +65,9 @@ const graphqlQuery = `{

// fetch the data
const result = await fetch(graphqlEndpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: graphqlQuery }),
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query: graphqlQuery })
});
const orders = await result.json().then(res => res.data.account.orders.nodes);

Expand All @@ -78,7 +78,7 @@ const graphqlQuery = `{
name: order.fromAccount.name,
url: order.fromAccount.website,
image: order.fromAccount.imageUrl,
monthlyDonation: order.frequency === 'year' ? Math.round(order.amount.value * 100 / 12) : order.amount.value * 100,
monthlyDonation: order.frequency === "year" ? Math.round(order.amount.value * 100 / 12) : order.amount.value * 100,
totalDonations: order.totalDonations.value * 100
};

Expand Down
6 changes: 2 additions & 4 deletions _tools/fetch-team-data.js
Expand Up @@ -84,10 +84,8 @@ const team = {
}

// filter out TSC members and reviewers from committers list
team.committers = team.committers.filter(user => {
return !team.tsc.find(tscmember => tscmember.username === user.username)
&& !team.reviewers.find(tscmember => tscmember.username === user.username);
});
team.committers = team.committers.filter(user => !team.tsc.find(tscmember => tscmember.username === user.username) &&
!team.reviewers.find(tscmember => tscmember.username === user.username));

fs.writeFileSync(filename, JSON.stringify(team, null, " "), { encoding: "utf8" });
})();
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 0 additions & 3 deletions demo/index.html
Expand Up @@ -3,9 +3,6 @@
layout: demo
demopage: true
---

<link rel="stylesheet" property="stylesheet" href="../styles/demo.css"/>

<div id="app">
<div class="loading-demo-message">
Loading...
Expand Down
41 changes: 0 additions & 41 deletions js/app/.eslintrc.yml

This file was deleted.