mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-09 10:50:34 -05:00
Add EsLint and editorconfig #19
This commit is contained in:
parent
1967473dee
commit
5db7084b34
6 changed files with 1196 additions and 15 deletions
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
indent_size = 4
|
3
.eslintrc.json
Normal file
3
.eslintrc.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": ["standard"]
|
||||
}
|
91
.gitignore
vendored
91
.gitignore
vendored
|
@ -1,2 +1,93 @@
|
|||
.DS_Store
|
||||
resources
|
||||
|
||||
# Created by https://www.gitignore.io/api/node
|
||||
# Edit at https://www.gitignore.io/?templates=node
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# End of https://www.gitignore.io/api/node
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
var lunrIndex
|
||||
var lunrResult
|
||||
var pagesIndex
|
||||
/* global lunr $ */
|
||||
let lunrIndex
|
||||
let lunrResult
|
||||
let pagesIndex
|
||||
|
||||
var bigramTokeniser = function (obj, metadata) {
|
||||
if (obj == null || obj == undefined) {
|
||||
const bigramTokeniser = (obj, metadata) => {
|
||||
if (obj == null || obj === undefined) {
|
||||
return []
|
||||
}
|
||||
|
||||
|
@ -16,15 +17,15 @@ var bigramTokeniser = function (obj, metadata) {
|
|||
})
|
||||
}
|
||||
|
||||
var str = obj.toString().trim().toLowerCase(),
|
||||
tokens = []
|
||||
var str = obj.toString().trim().toLowerCase()
|
||||
var tokens = []
|
||||
|
||||
for(var i = 0; i <= str.length - 2; i++) {
|
||||
for (var i = 0; i <= str.length - 2; i++) {
|
||||
var tokenMetadata = lunr.utils.clone(metadata) || {}
|
||||
tokenMetadata["position"] = [i, i + 2]
|
||||
tokenMetadata["index"] = tokens.length
|
||||
tokenMetadata['position'] = [i, i + 2]
|
||||
tokenMetadata['index'] = tokens.length
|
||||
tokens.push(
|
||||
new lunr.Token (
|
||||
new lunr.Token(
|
||||
str.slice(i, i + 2),
|
||||
tokenMetadata
|
||||
)
|
||||
|
@ -35,10 +36,10 @@ var bigramTokeniser = function (obj, metadata) {
|
|||
}
|
||||
|
||||
var queryNgramSeparator = function (query) {
|
||||
var str = query.toString().trim().toLowerCase(),
|
||||
tokens = []
|
||||
var str = query.toString().trim().toLowerCase()
|
||||
var tokens = []
|
||||
|
||||
for(var i = 0; i <= str.length - 2; i++) {
|
||||
for (var i = 0; i <= str.length - 2; i++) {
|
||||
tokens.push(str.slice(i, i + 2))
|
||||
}
|
||||
|
||||
|
@ -48,7 +49,7 @@ var queryNgramSeparator = function (query) {
|
|||
/**
|
||||
* Preparation for using lunr.js
|
||||
*/
|
||||
function initLunr () {
|
||||
const initLunr = () => {
|
||||
$.getJSON('index.json').done(function (index) {
|
||||
pagesIndex = index
|
||||
lunrIndex = lunr(function () {
|
||||
|
|
15
package.json
Normal file
15
package.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "pulp",
|
||||
"version": "1.0.0",
|
||||
"repository": "git@github.com:koirand/pulp.git",
|
||||
"author": "koirand <koirand.jp@gmail.com>",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"eslint": "^5.15.3",
|
||||
"eslint-config-standard": "^12.0.0",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"eslint-plugin-node": "^8.0.1",
|
||||
"eslint-plugin-promise": "^4.0.1",
|
||||
"eslint-plugin-standard": "^4.0.0"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue