@trenskow/localization-data 1.3.4 → 1.4.1

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.
@@ -0,0 +1,46 @@
1
+ import globals from 'globals';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import js from '@eslint/js';
5
+ import { FlatCompat } from '@eslint/eslintrc';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const compat = new FlatCompat({
10
+ baseDirectory: __dirname,
11
+ recommendedConfig: js.configs.recommended,
12
+ allConfig: js.configs.all
13
+ });
14
+
15
+ export default [...compat.extends('eslint:recommended'), {
16
+ languageOptions: {
17
+ globals: {
18
+ ...globals.node,
19
+ ...globals.mocha,
20
+ },
21
+
22
+ ecmaVersion: 'latest',
23
+ sourceType: 'module',
24
+ },
25
+
26
+ rules: {
27
+ indent: ['error', 'tab'],
28
+ 'linebreak-style': ['error', 'unix'],
29
+ quotes: ['error', 'single'],
30
+ semi: ['error', 'always'],
31
+
32
+ 'no-console': ['error', {
33
+ allow: ['warn', 'error', 'info'],
34
+ }],
35
+
36
+ 'no-unused-vars': ['error', {
37
+ argsIgnorePattern: '^_',
38
+ }],
39
+
40
+ 'no-empty': ['error', {
41
+ allowEmptyCatch: true,
42
+ }],
43
+
44
+ 'require-atomic-updates': 'off',
45
+ },
46
+ }];
package/index.js CHANGED
@@ -1,14 +1,13 @@
1
- 'use string';
1
+ import { readFileSync } from 'fs';
2
+ import { join } from 'path';
2
3
 
3
- const
4
- countriesList = require('countries-list'),
5
- merge = require('merge');
4
+ import { countries, languages } from 'countries-list';
5
+ import merge from '@trenskow/merge';
6
6
 
7
- const
8
- scripts = require('./dist/scripts.json'),
9
- languagesScripts = require('./dist/languages-scripts.json');
7
+ const scripts = JSON.parse(readFileSync(join(import.meta.dirname, 'dist', 'scripts.json'), 'utf8'));
8
+ const languagesScripts = JSON.parse(readFileSync(join(import.meta.dirname, 'dist', 'languages-scripts.json'), 'utf8'));
10
9
 
11
- module.exports = merge({}, countriesList, {
10
+ export default merge({}, countries, {
12
11
  scripts: scripts,
13
- languages: merge.recursive(countriesList.languages, languagesScripts)
12
+ languages: merge(languages, languagesScripts)
14
13
  });
package/package.json CHANGED
@@ -1,26 +1,31 @@
1
1
  {
2
- "name": "@trenskow/localization-data",
3
- "version": "1.3.4",
4
- "description": "A collection of languages, scripts and countries.",
5
- "main": "index.js",
6
- "scripts": {
7
- "generate": "node ./generator/"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/trenskow/localization-data.git"
12
- },
13
- "author": "Kristian Trenskow <trenskow@me.com>",
14
- "license": "MIT",
15
- "bugs": {
16
- "url": "https://github.com/trenskow/localization-data/issues"
17
- },
18
- "homepage": "https://github.com/trenskow/localization-data#readme",
19
- "dependencies": {
20
- "countries-list": "^3.1.0",
21
- "merge": "^2.1.1"
22
- },
23
- "devDependencies": {
24
- "xml2js": "^0.6.2"
25
- }
2
+ "name": "@trenskow/localization-data",
3
+ "version": "1.4.1",
4
+ "description": "A collection of languages, scripts and countries.",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "generate": "node ./generator/"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/trenskow/localization-data.git"
13
+ },
14
+ "author": "Kristian Trenskow <trenskow@me.com>",
15
+ "license": "MIT",
16
+ "bugs": {
17
+ "url": "https://github.com/trenskow/localization-data/issues"
18
+ },
19
+ "homepage": "https://github.com/trenskow/localization-data#readme",
20
+ "dependencies": {
21
+ "@trenskow/merge": "^0.1.26",
22
+ "countries-list": "^3.1.0"
23
+ },
24
+ "devDependencies": {
25
+ "@eslint/eslintrc": "^3.1.0",
26
+ "@eslint/js": "^9.13.0",
27
+ "eslint": "^9.13.0",
28
+ "globals": "^15.11.0",
29
+ "xml2js": "^0.6.2"
30
+ }
26
31
  }
package/.eslintrc.js DELETED
@@ -1,49 +0,0 @@
1
- module.exports = {
2
- "env": {
3
- "es6": true,
4
- "node": true,
5
- "mocha": true
6
- },
7
- "parserOptions": {
8
- "ecmaVersion": 2017
9
- },
10
- "extends": "eslint:recommended",
11
- "rules": {
12
- "indent": [
13
- "error",
14
- "tab"
15
- ],
16
- "linebreak-style": [
17
- "error",
18
- "unix"
19
- ],
20
- "quotes": [
21
- "error",
22
- "single"
23
- ],
24
- "semi": [
25
- "error",
26
- "always"
27
- ],
28
- "no-console": [
29
- "error", {
30
- "allow": [
31
- "warn",
32
- "error",
33
- "info"
34
- ]
35
- }
36
- ],
37
- "no-unused-vars": [
38
- "error", {
39
- "argsIgnorePattern": "^_"
40
- }
41
- ],
42
- "no-empty": [
43
- "error", {
44
- "allowEmptyCatch": true
45
- }
46
- ],
47
- "require-atomic-updates": "off"
48
- }
49
- };