Skip to content

Commit

Permalink
chore: configs
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Mar 28, 2019
1 parent a1dbae5 commit 5827e7f
Show file tree
Hide file tree
Showing 19 changed files with 1,220 additions and 111 deletions.
6 changes: 3 additions & 3 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# config file for `dependabot`
#
# update: wget https://git.io/fhAJq
# update: wget -O config.yml https://git.io/fjJKB
# document: https://dependabot.com/docs/config-file/
#

Expand All @@ -10,7 +10,7 @@ update_configs:
# new versions are published to the npm registry
- package_manager: "javascript"
directory: "/"
update_schedule: "daily"
update_schedule: "live"

# Automerge all development updates and production
# security (semver patch) updates (waiting for CI to pass)
Expand All @@ -23,4 +23,4 @@ update_configs:
update_type: "security:patch"

# auto update package.json
version_requirement_updates: "auto"
version_requirement_updates: "increase_versions"
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# config file for `editorconfig`
#
# update: wget https://git.io/fhAJu
# update: wget -O .editorconfig https://git.io/fhAJu
# document: https://editorconfig.org
#

Expand Down Expand Up @@ -36,3 +36,7 @@ indent_size = 4
[*.{bat,cmd}]
charset = ansi
end_of_line = crlf

# markdown
[*.{md,markdown}]
insert_final_newline = false
15 changes: 9 additions & 6 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@

# ignore file for `eslint`
#
# update: wget https://git.io/fhNp3
# update: wget -O .eslintignore https://git.io/fhNp3
# document: https://eslint.org/docs/user-guide/configuring#eslintignore
#

# also lint dot files
!.*

# vendors
node_modules/**
**/vendors/**
**/vendor/**
**/third-party/**

# build file
lib/**
dist/**
**/*.min.*

# node_modules
node_modules/**

# fixtures
**/fixtures/**

# own glob
# project glob
13 changes: 3 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
/*!
* config file for `eslint`
*
* update: wget https://git.io/fhNxh
* update: wget -O .eslintrc.js https://git.io/fjJKA
* document: https://eslint.org/docs/user-guide/configuring
*/

/* eslint-disable no-unused-vars */

/* @xwtec/eslint-config https://git.io/fhNpT */
const xwtec = (pkg => ({
default: pkg,
legacy: `${pkg}/legacy`,
vue: `${pkg}/vue`,
}))('@xwtec/eslint-config')
/* eslint-config-fisker https://git.io/fjJKy */

module.exports = {
root: true,
parserOptions: {},
extends: [xwtec.default],
extends: ['fisker'],
settings: {},
rules: {},
plugins: [],
Expand Down
2 changes: 1 addition & 1 deletion .huskyrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* config file for `husky`
*
* update: wget https://git.io/fhNpR
* update: wget-O .huskyrc.js https://git.io/fhNpR
* document: https://git.io/fhNph
*/

Expand Down
14 changes: 9 additions & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# ignore file for `prettier`
#
# update: wget https://git.io/fhNj3
# update: wget -O .prettierignore https://git.io/fhNj3
# document: https://prettier.io/docs/en/ignore.html#ignoring-files
#

# also prettier dot files
!.*

# vendors
node_modules/**
**/vendors/**
**/vendor/**
**/third-party/**

# build file
lib/**
dist/**
**/*.min.*

# node_modules
node_modules/**

# fixtures
**/fixtures/**

# own glob
# project glob

24 changes: 24 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

# ignore file for `stylelint`
#
# update: wget -O .stylelintignore https://git.io/fjJP6
# document: https://stylelint.io/user-guide/configuration/#ignorefiles

# also lint dot files
!.*

# vendors
node_modules/**
**/vendors/**
**/vendor/**
**/third-party/**

# build file
lib/**
dist/**
**/*.min.*

# fixtures
**/fixtures/**

# project glob
8 changes: 0 additions & 8 deletions .whitesource

This file was deleted.

2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* config file for `commitlint`
*
* update: wget https://git.io/fhAJV
* update: wget -O commitlint.config.js https://git.io/fhAJV
* document: https://git.io/fhAJa
*/

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./lib/index.js')
module.exports = require('./lib')
2 changes: 1 addition & 1 deletion LICENSE → license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 fisker Cheung
Copyright (c) fisker Cheung <lionkay@gmail.com> (https://www.fiskercheung.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 2 additions & 3 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/*!
* config file for `lint-staged`
*
* update: wget https://git.io/fhNpr
* update: wget -O lint-staged.config.js https://git.io/fhNpr
* document: https://git.io/fhNpF
*
*/

/* eslint-disable no-unused-vars */

const CMD_PRETTIER = 'prettier --write'
// eslint-disable-next-line no-unused-vars
const CMD_ESLINT = 'eslint'
const CMD_ESLINT_FIX = 'eslint --fix'
const CMD_MARKDOWNLINT = 'markdownlint'
Expand Down
17 changes: 6 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": {
"name": "fisker Cheung",
"email": "lionkay@gmail.com",
"url": "https://github.com/fisker"
"url": "https://www.fiskercheung.com/"
},
"license": "MIT",
"bugs": {
Expand All @@ -31,14 +31,17 @@
"city-lights-icons": "github:Yummygum/city-lights-icons-atom",
"cz-conventional-changelog-emoji": "0.1.0",
"eslint": "5.15.3",
"eslint-config-fisker": "^4.1.0",
"husky": "1.3.1",
"json-stable-stringify": "1.0.1",
"lint-staged": "8.1.5",
"markdownlint-cli": "^0.14.0",
"markdownlint-cli": "^0.14.1",
"mini-svg-data-uri": "1.0.3",
"node-sass": "4.11.0",
"np": "^4.0.2",
"prettier": "1.16.4",
"stylelint": "^9.10.1",
"stylelint-config-fisker": "^0.0.4",
"svgo": "1.2.0"
},
"scripts": {
Expand All @@ -51,19 +54,11 @@
"registry": "https://registry.npmjs.org/"
},
"readmeFilename": "README.md",
"files": [
"LICENSE",
"README.md",
"index.js",
"package.json",
"lib/index.js",
"lib/asserts.json"
],
"files": ["index.js", "lib/index.js", "lib/asserts.json"],
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog-emoji"
}
},
"readme": "ERROR: No README data found!",
"homepage": "https://github.com/fisker/serve-directory-theme-city-lights#readme"
}
60 changes: 34 additions & 26 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
/*!
* config file for `prettier`
*
* update: wget https://git.io/fhNjs
* update: wget -O prettier.config.js https://git.io/fjJKh
* document: https://prettier.io/docs/en/options.html
*/

/* eslint-disable no-unused-vars */
// https://prettier.io/docs/en/options.html
const SUPPORTED_OPTIONS = [
'printWidth',
'tabWidth',
'useTabs',
'semi',
'singleQuote',
'jsxSingleQuote',
'trailingComma',
'bracketSpacing',
'jsxBracketSameLine',
'arrowParens',
'rangeStart',
'rangeEnd',
'parser',
'filepath',
'requirePragma',
'insertPragma',
'proseWrap',
'htmlWhitespaceSensitivity',
'endOfLine',
]

// default options
const DEAULT_CONFIG = {
// default config
const DEFAULT_CONFIG = {
bracketSpacing: false,
htmlWhitespaceSensitivity: 'ignore',
semi: false,
Expand Down Expand Up @@ -53,9 +74,7 @@ const LANG_CONFIG = {
less: {
singleQuote: false,
},
vue: {
singleQuote: false,
},
vue: {},
json: {
singleQuote: false,
},
Expand All @@ -65,27 +84,18 @@ const LANG_CONFIG = {
mdx: {},
}

// custom config
const overrides = [
// custom overrides
const CUSTOM_OVERRIDES = [
// {
// files: '*.ext',
// files: 'your glob',
// options: {
// parser: 'some-parser',
// singleQuote: false,
// [option key]: [option value],
// }
// }
// },
]

// export

const SUPPORTED_OPTIONS = [
'singleQuote',
'semi',
'singleQuote',
'bracketSpacing',
'htmlWhitespaceSensitivity',
]

function toArray(x) {
x = Array.isArray(x) ? x : x.split(',')
return x.filter(Boolean).map(s => s.trim())
Expand All @@ -97,9 +107,7 @@ function isUndefined(x) {

function isNotDefault(config, option) {
const configValue = config[option]
const defaultValue = DEAULT_CONFIG[option]

// console.log({option, configValue, defaultValue})
const defaultValue = DEFAULT_CONFIG[option]

return (
!isUndefined(configValue) &&
Expand Down Expand Up @@ -169,8 +177,8 @@ function langOverrides(config) {
}

module.exports = {
...DEAULT_CONFIG,
...DEFAULT_CONFIG,

// overrides
overrides: [...langOverrides(LANG_CONFIG), ...overrides],
overrides: [...langOverrides(LANG_CONFIG), ...CUSTOM_OVERRIDES],
}
File renamed without changes.
2 changes: 2 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const nodeSass = require('node-sass')
const babel = require('@babel/core')
const prettier = require('prettier')
const stringify = require('json-stable-stringify')

const babelConfig = JSON.parse(fs.readFileSync('../.babelrc', CHARSET))

const SVGO = require('svgo')
const svgToMiniDataURI = require('mini-svg-data-uri')

const svgo = new SVGO()

const iconMap = {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function getIconName(file) {
return 'html'
}

if (ext === 'es' || ext === 'es6' || ext === 'js') {
if (ext === 'es' || ext === 'es6' || ext === 'js' || ext === 'mjs') {
return 'js'
}

Expand Down
12 changes: 12 additions & 0 deletions stylelint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*!
* config file for `stylelint`
*
* update: wget -O stylelint.config.js https://git.io/fjJP1
* document: https://stylelint.io/user-guide/configuration/
*/

/* eslint-config-fisker https://git.io/fjJPX */

module.exports = {
extends: ['stylelint-config-fisker'],
}

0 comments on commit 5827e7f

Please sign in to comment.