@lightscale/webpack-config 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -7,6 +7,7 @@ import EsLintPlugin from 'eslint-webpack-plugin';
7
7
  import WebpackbarPlugin from 'webpackbar';
8
8
  import CleanTerminalPlugin from 'clean-terminal-webpack-plugin';
9
9
  import {CleanWebpackPlugin} from 'clean-webpack-plugin';
10
+ import Autoprefixer from 'autoprefixer';
10
11
 
11
12
  export class Paths {
12
13
  #jsSourcePath;
@@ -28,6 +29,89 @@ export class Paths {
28
29
  }
29
30
  };
30
31
 
32
+ const babelConfig = {
33
+ presets: [
34
+ "@babel/preset-env"
35
+ ],
36
+ plugins: [
37
+ ["polyfill-corejs3", { method: "usage-global"}]
38
+ ],
39
+ };
40
+
41
+ const postCssConfig = {
42
+ plugins: [
43
+ Autoprefixer
44
+ ]
45
+ };
46
+
47
+ const esLintConfig = {
48
+ 'root': true,
49
+ 'extends': [
50
+ 'eslint:recommended'
51
+ ],
52
+ 'globals': {
53
+ 'wp': true,
54
+ },
55
+ 'env': {
56
+ 'node': true,
57
+ 'es6': true,
58
+ 'amd': true,
59
+ 'browser': true,
60
+ 'jquery': true,
61
+ },
62
+ 'parser': '@babel/eslint-parser',
63
+ 'parserOptions': {
64
+ 'ecmaFeatures': {
65
+ 'globalReturn': true,
66
+ 'generators': false,
67
+ 'objectLiteralDuplicateProperties': false,
68
+ 'experimentalObjectRestSpread': true,
69
+ },
70
+ 'ecmaVersion': 2017,
71
+ 'sourceType': 'module',
72
+ 'requireConfigFile': false,
73
+ },
74
+ 'plugins': [
75
+
76
+ ],
77
+ 'settings': {
78
+ 'import/core-modules': [],
79
+ 'import/ignore': [
80
+ 'node_modules',
81
+ '\\.(coffee|scss|css|less|hbs|svg|json)$',
82
+ ]
83
+ },
84
+ 'rules': {
85
+ 'no-console': 0,
86
+ 'quotes': ['error', 'single'],
87
+ 'semi': ['warn', 'always'],
88
+ 'comma-dangle': 0,
89
+ },
90
+ };
91
+
92
+ const styleLintConfig = {
93
+ 'extends': 'stylelint-config-standard',
94
+ 'plugins': ['stylelint-scss'],
95
+ 'customSyntax': 'postcss-scss',
96
+ 'rules': {
97
+ 'no-empty-source': null,
98
+ //'selector-id-pattern': null,
99
+ 'selector-class-pattern': null, // TODO: remove and fix
100
+ 'at-rule-no-unknown': null,
101
+ 'function-no-unknown': null,
102
+ 'no-invalid-position-at-import-rule': [
103
+ true,
104
+ {
105
+ ignoreAtRules: ["/^use$/"]
106
+ }
107
+ ],
108
+ 'scss/at-rule-no-unknown': true,
109
+ 'import-notation': null,
110
+ 'annotation-no-unknown': null,
111
+ },
112
+ };
113
+
114
+
31
115
  export const makeConfig = (env, argv, options) => {
32
116
  const isProd = argv.mode === 'production',
33
117
  isDev = argv.mode === 'development',
@@ -75,8 +159,10 @@ export const makeConfig = (env, argv, options) => {
75
159
  }),
76
160
  new StylelintPlugin({
77
161
  failOnError: !isWatch,
162
+ config: styleLintConfig,
78
163
  }),
79
164
  new EsLintPlugin({
165
+ baseConfig: esLintConfig,
80
166
  overrideConfig: {
81
167
  rules: {
82
168
  "no-console": isProd ? 2 : 1,
@@ -101,9 +187,10 @@ export const makeConfig = (env, argv, options) => {
101
187
  {
102
188
  test: /\.js$/i,
103
189
  include: paths.sourcePath,
104
- use: [
105
- 'babel-loader'
106
- ]
190
+ use: {
191
+ loader: 'babel-loader',
192
+ options: babelConfig,
193
+ }
107
194
  },
108
195
  {
109
196
  test: /\.s[ac]ss$/i,
@@ -111,7 +198,12 @@ export const makeConfig = (env, argv, options) => {
111
198
  use: [
112
199
  MiniCssExtractPlugin.loader,
113
200
  'css-loader',
114
- 'postcss-loader',
201
+ {
202
+ loader: 'postcss-loader',
203
+ options: {
204
+ postcssOptions: postCssConfig
205
+ }
206
+ },
115
207
  'sass-loader',
116
208
  ],
117
209
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightscale/webpack-config",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Basic webpack config with js babel, postcss, scss, svg",
5
5
  "main": "index.js",
6
6
  "auther": "Sam Light",
Binary file