Skip to content

Commit

Permalink
dev: update .eslintrc.yml & fix no-use-before-define error
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Aug 1, 2022
1 parent 0481154 commit 9176a8d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
13 changes: 12 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ env:
es6: true
extends:
- 'eslint:recommended'
- 'plugin:node/recommended'
- 'plugin:import/recommended'
- 'prettier'
parserOptions:
ecmaVersion: 2017
ecmaVersion: 2020
rules:
no-console: error
prefer-const: error
no-var: error
no-use-before-define: error
no-await-in-loop: error
node/exports-style: [0, error]
import/first: error
import/no-anonymous-default-export: error
import/no-unassigned-import: error
import/no-internal-modules: error
32 changes: 16 additions & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ const relink = (data, moved) => {
data.contents = Buffer.from(content)
}

/**
* Check whether a file is an HTML file.
*
* @param {string} str The path
* @return {boolean}
*/
const html = (str) => path.extname(str) === '.html'

/**
* Return a formatter for a given moment.js format `string`.
*
* @param {string} string
* @return {Function}
*/
const format = (string) => (date) => moment(date).utc().format(string)

/**
* Normalize an options argument.
*
Expand All @@ -117,14 +133,6 @@ const normalizeOptions = (options) => {
return options
}

/**
* Return a formatter for a given moment.js format `string`.
*
* @param {string} string
* @return {Function}
*/
const format = (string) => (date) => moment(date).utc().format(string)

/**
* Get a list of sibling and children files for a given `file` in `files`.
*
Expand Down Expand Up @@ -237,14 +245,6 @@ const replace = (pattern, data, options) => {
return transformed
}

/**
* Check whether a file is an HTML file.
*
* @param {string} str The path
* @return {boolean}
*/
const html = (str) => path.extname(str) === '.html'

/**
* Metalsmith plugin that renames files so that they're permalinked properly
* for a static site, aka that `about.html` becomes `about/index.html`.
Expand Down

0 comments on commit 9176a8d

Please sign in to comment.